diff --git a/lib/better_errors/templates/main.erb b/lib/better_errors/templates/main.erb index 43046056..481bcfdd 100644 --- a/lib/better_errors/templates/main.erb +++ b/lib/better_errors/templates/main.erb @@ -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; @@ -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; @@ -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) { diff --git a/lib/better_errors/templates/variable_info.erb b/lib/better_errors/templates/variable_info.erb index 8d6bd166..d56b4994 100644 --- a/lib/better_errors/templates/variable_info.erb +++ b/lib/better_errors/templates/variable_info.erb @@ -12,6 +12,7 @@

                 
>>
+
Clear Shell
<% end %>