mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 20:10:17 +00:00
commit
2470a1555c
17
web/index.js
17
web/index.js
@ -143,13 +143,14 @@ function term_init() {
|
|||||||
term.write(need_more_lines ? "... " : ">>> ");
|
term.write(need_more_lines ? "... " : ">>> ");
|
||||||
break;
|
break;
|
||||||
case '\u007F': // Backspace (DEL)
|
case '\u007F': // Backspace (DEL)
|
||||||
// Do not delete the prompt
|
var cnt = term._core.buffer.x-4;
|
||||||
if (term._core.buffer.x > 4) { // '>>> ' or '... '
|
if(cnt<=0 || command.length==0) break;
|
||||||
term.write('\b \b');
|
// delete the last unicode char
|
||||||
if (command.length > 0) {
|
command = command.replace(/.$/u, "");
|
||||||
command = command.substr(0, command.length - 1);
|
// clear the whole line
|
||||||
}
|
term.write('\b \b'.repeat(cnt));
|
||||||
}
|
// re-write the command
|
||||||
|
term.write(command);
|
||||||
break;
|
break;
|
||||||
default: // Print all other characters for demo
|
default: // Print all other characters for demo
|
||||||
if (e >= String.fromCharCode(0x20) && e <= String.fromCharCode(0x7E) || e >= '\u00a0') {
|
if (e >= String.fromCharCode(0x20) && e <= String.fromCharCode(0x7E) || e >= '\u00a0') {
|
||||||
@ -158,4 +159,4 @@ function term_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user