fix eof not detected (resume)

This commit is contained in:
b1ek 2023-03-16 17:31:37 +10:00
parent 89acd8a4a6
commit 1e90b97973
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 14 additions and 4 deletions

View File

@ -47,7 +47,7 @@ function exec_file(f) {
return; return;
} }
function exec_cmd() { async function exec_cmd() {
let c = cmd; let c = cmd;
const command = c.split(' ')[0]; const command = c.split(' ')[0];
reset_cmd(c); reset_cmd(c);
@ -68,8 +68,13 @@ function exec_cmd() {
} }
if (cmds[command] != undefined) { if (cmds[command] != undefined) {
cmds[command](c.split(' '), terminal); const startY = terminal.buffer.normal.cursorY
if (terminal.buffer.active.cursorX != 0) {
await cmds[command](c.split(' '), terminal);
await (new Promise(resolve => setTimeout(resolve, 10)));
if (terminal.buffer.active.cursorX != 0 && startY != terminal.buffer.active.cursorY) {
terminal.write('\033[30;47m%\033[0m\n'); terminal.write('\033[30;47m%\033[0m\n');
} }
print_prompt(); print_prompt();
@ -137,6 +142,11 @@ function control_char(id, dom) {
default: default:
if (dom.ctrlKey && (dom.key.length == 1)) {
terminal.write('^' + dom.key.toUpperCase());
break;
}
terminal.write('<'); terminal.write('<');
if (dom.ctrlKey) terminal.write('C'); if (dom.ctrlKey) terminal.write('C');
if (dom.altKey) terminal.write('A'); if (dom.altKey) terminal.write('A');