From ba9d5eb671997a3a7b82eeb3eb04c0a3e5c3a966 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 16 Mar 2016 13:37:48 +0100 Subject: Add clear command for Prolog console --- js/codeq/console.js | 8 ++++++++ js/codeq/prolog.js | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/js/codeq/console.js b/js/codeq/console.js index 5317355..13f1404 100644 --- a/js/codeq/console.js +++ b/js/codeq/console.js @@ -625,6 +625,14 @@ along with this program. If not, see . */ this.reflow(startRow < originalCurrentRow ? startRow : originalCurrentRow); }, + 'clear': function () { + while (lines.length > 0) + this.removeRow(0, true); + lines.push({content: '', classNames: []}); + currentRow = currentCol = 0; + this.reflow(); + }, + 'insertAtCursor': function (text, className, dontMoveCursor) { var startRow = currentRow, currentLine = lines[currentRow], diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index e739b26..194f6a8 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -119,6 +119,11 @@ along with this program. If not, see . */ terminal.append('?- ', 'output'); return; } + if (command.match(/^clear\.*$/)) { + terminal.clear(); + terminal.append('?- ', 'output'); + return; + } promptMode = false; manualStop = false; terminal.setNotBuffered(); -- cgit v1.2.1