Skip to content

Commit

Permalink
Merge sagarbommidi/clear_shell
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDaugherty committed Jul 27, 2017
2 parents 7b9dfcd + 7ef617f commit cad1fe1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/better_errors/templates/main.erb
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,16 @@
margin: 0;
}

.console .clear_output {
text-align: right;
margin-right: 1em;
}

.console .clear_output a {
color: red;
}


/* Hint text */
.hint {
margin: 15px 0 20px 0;
Expand Down Expand Up @@ -812,12 +822,18 @@
this.promptElement = this.container.querySelector(".prompt span");
this.inputElement = this.container.querySelector("input");
this.outputElement = this.container.querySelector("pre");
this.outputClearElement = this.container.querySelector(".clear_output");

var self = this;
this.inputElement.onkeydown = function(ev) {
self.onKeyDown(ev);
};

this.outputClearElement.onclick = function(ev) {
ev.preventDefault();
self.clearOutput();
};

this.setPrompt(">>");

REPL.all[this.index] = this;
Expand Down Expand Up @@ -854,6 +870,11 @@
this.writeRawOutput(escapeHTML(output));
};

REPL.prototype.clearOutput = function() {
this.outputElement.innerHTML = '';
this.outputElement.scrollTop = this.outputElement.scrollHeight;
};

REPL.prototype.sendInput = function(line) {
var self = this;
apiCall("eval", { "index": this.index, source: line }, function(response) {
Expand Down
1 change: 1 addition & 0 deletions lib/better_errors/templates/variable_info.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<div class="console">
<pre></pre>
<div class="prompt"><span>&gt;&gt;</span> <input/></div>
<div class="clear_output"><a href='#'>Clear Shell</a></div>
</div>
</div>
<% end %>
Expand Down

0 comments on commit cad1fe1

Please sign in to comment.