[demo] Add Exit to local-echo

and fix autocomplete suggestions showing up when they shouldn't
pull/1/head
cpsdqs 7 years ago
parent 8b610aa95b
commit fcfd351b6e
Signed by untrusted user: cpsdqs
GPG Key ID: 3F59586BB7448DD1
  1. 13
      js/term/demo.js

@ -461,14 +461,22 @@ let demoshIndex = {
'local-echo': class LocalEcho extends Process { 'local-echo': class LocalEcho extends Process {
run (...args) { run (...args) {
if (!args.includes('--suppress-note')) { if (!args.includes('--suppress-note')) {
this.emit('write', '\x1b[38;5;239mNote: not all terminal features are supported or and may not work as expected in this demo\x1b[0m\r\n') this.emit('write', '\x1b[38;5;239mNote: not all terminal features are supported and may not work as expected in this demo\x1b[m\n')
} }
this.emit('buttons', [
{
label: 'Exit',
action (shell) {
shell.write('\x03')
}
}
])
} }
write (data) { write (data) {
this.emit('write', data) this.emit('write', data)
} }
}, },
'info': class Info extends Process { info: class Info extends Process {
run (...args) { run (...args) {
let fast = args.includes('--fast') let fast = args.includes('--fast')
this.showSplash().then(() => { this.showSplash().then(() => {
@ -953,6 +961,7 @@ class DemoShell {
prefix = input.substr(0, input.length - newInput.length) prefix = input.substr(0, input.length - newInput.length)
input = newInput input = newInput
} }
if (!input) return null
for (let name in this.index) { for (let name in this.index) {
if (name.startsWith(input) && name !== input) { if (name.startsWith(input) && name !== input) {
if (visual && name in autocompleteIndex) return prefix + autocompleteIndex[name] if (visual && name in autocompleteIndex) return prefix + autocompleteIndex[name]

Loading…
Cancel
Save