Comsume TAB in demo instead of printing U+FFFD

box-drawing
Ondřej Hruška 7 years ago
parent a72c229ab3
commit c744755679
  1. 5
      js/term/demo.js

@ -91,6 +91,7 @@ class ANSIParser {
else if (code <= 0x06) this.handler('_null') else if (code <= 0x06) this.handler('_null')
else if (code === 0x07) this.handler('bell') else if (code === 0x07) this.handler('bell')
else if (code === 0x08) this.handler('back') 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 === 0x0a) this.handler('new-line')
else if (code === 0x0d) this.handler('return') else if (code === 0x0d) this.handler('return')
else if (code === 0x15) this.handler('delete-line') else if (code === 0x15) this.handler('delete-line')
@ -204,7 +205,7 @@ class ScrollingTerminal {
} else if (action === 'clear') { } else if (action === 'clear') {
this.clear() this.clear()
} else if (action === 'bell') { } else if (action === 'bell') {
this.terminal.load('B') // FIXME undefined? this.termScreen.load('B')
} else if (action === 'back') { } else if (action === 'back') {
this.moveBack() this.moveBack()
} else if (action === 'new-line') { } else if (action === 'new-line') {
@ -791,6 +792,8 @@ class DemoShell {
this.history[0] = this.history[0].substr(0, this.cursorPos - 1) + this.history[0].substr(this.cursorPos) this.history[0] = this.history[0].substr(0, this.cursorPos - 1) + this.history[0].substr(this.cursorPos)
this.cursorPos-- this.cursorPos--
if (this.cursorPos < 0) this.cursorPos = 0 if (this.cursorPos < 0) this.cursorPos = 0
} else if (action === 'tab') {
console.warn('TAB not implemented') // TODO completion
} else if (action === 'move-cursor-x') { } else if (action === 'move-cursor-x') {
this.cursorPos = Math.max(0, Math.min(this.history[this.historyIndex].length, this.cursorPos + args[0])) this.cursorPos = Math.max(0, Math.min(this.history[this.historyIndex].length, this.cursorPos + args[0]))
} else if (action === 'delete-line') { } else if (action === 'delete-line') {

Loading…
Cancel
Save