From c744755679b41c66c02436108b5115ad9ea05367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 23 Sep 2017 14:27:23 +0200 Subject: [PATCH] Comsume TAB in demo instead of printing U+FFFD --- js/term/demo.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/term/demo.js b/js/term/demo.js index 33b515e..e76279b 100644 --- a/js/term/demo.js +++ b/js/term/demo.js @@ -91,6 +91,7 @@ class ANSIParser { else if (code <= 0x06) this.handler('_null') else if (code === 0x07) this.handler('bell') else if (code === 0x08) this.handler('back') + else if (code === 0x09) this.handler('tab') else if (code === 0x0a) this.handler('new-line') else if (code === 0x0d) this.handler('return') else if (code === 0x15) this.handler('delete-line') @@ -204,7 +205,7 @@ class ScrollingTerminal { } else if (action === 'clear') { this.clear() } else if (action === 'bell') { - this.terminal.load('B') // FIXME undefined? + this.termScreen.load('B') } else if (action === 'back') { this.moveBack() } else if (action === 'new-line') { @@ -555,7 +556,7 @@ let demoshIndex = { let theme = +args[0] | 0 const maxnum = themes.length if (!args.length || !Number.isFinite(theme) || theme < 0 || theme >= maxnum) { - this.emit('write', `\x1b[31mUsage: theme [0–${maxnum-1}]\r\n`) + this.emit('write', `\x1b[31mUsage: theme [0–${maxnum - 1}]\r\n`) this.destroy() return } @@ -791,6 +792,8 @@ class DemoShell { this.history[0] = this.history[0].substr(0, this.cursorPos - 1) + this.history[0].substr(this.cursorPos) this.cursorPos-- if (this.cursorPos < 0) this.cursorPos = 0 + } else if (action === 'tab') { + console.warn('TAB not implemented') // TODO completion } else if (action === 'move-cursor-x') { this.cursorPos = Math.max(0, Math.min(this.history[this.historyIndex].length, this.cursorPos + args[0])) } else if (action === 'delete-line') {