From a182f9b9d1dd04f583dc571a038d1bfba833178b Mon Sep 17 00:00:00 2001 From: Felix Dekker Date: Sat, 9 Feb 2019 14:37:36 +0100 Subject: [PATCH] Resolve #6 --- js/terminal.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/terminal.js b/js/terminal.js index 8a78641..1bc427b 100644 --- a/js/terminal.js +++ b/js/terminal.js @@ -113,6 +113,12 @@ class Terminal { this._inputHistory.clear(); } + ignoreInput() { + this.outputText += `${this.prefixText}${this.inputText}\n`; + this.prefixText = this.generatePrefix(); + this.inputText = ""; + } + processInput(input) { this.inputText = ""; @@ -155,6 +161,12 @@ class Terminal { this.inputText = this._inputHistory.nextEntry(); window.setTimeout(() => moveCaretToEndOf(this._input), 0); break; + case "c": + if (e.ctrlKey) { + this.ignoreInput(); + e.preventDefault(); + } + break; case "l": if (e.ctrlKey) { this.clear();