Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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