remove % at end of command if no new line

This commit is contained in:
b1ek 2023-05-06 11:18:58 +10:00
parent 60ad80616b
commit 7cf1d45283
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 4 additions and 6 deletions

View File

@ -74,9 +74,10 @@ async function get_stdin(opt) {
// special key // special key
switch (dom.keyCode) { switch (dom.keyCode) {
case 8: case 8:
if (terminal.buffer.active.cursorX <= startX) return; if (terminal.buffer.active.cursorX <= startX && (!opt.hide)) break;
terminal.write('\b \b'); if (!opt.hide) terminal.write('\b \b');
input = input.substring(0, input.length - 1); input = input.substring(0, input.length - 1);
break;
case 13: case 13:
break_loop = true; break_loop = true;
terminal.write('\n'); terminal.write('\n');
@ -155,13 +156,10 @@ async function exec_cmd() {
} }
if (cmds[command] != undefined) { if (cmds[command] != undefined) {
const startY = terminal.buffer.normal.cursorY
// execute command
await cmds[command](c.split(' '), terminal, zshapi); await cmds[command](c.split(' '), terminal, zshapi);
if (terminal.buffer.active.cursorX != 0 && startY != terminal.buffer.active.cursorY) {
terminal.write('\033[30;47m%\033[0m\n');
}
print_prompt(); print_prompt();
return; return;
} }