fix read line

This commit is contained in:
MeexReay 2025-03-21 23:38:20 +03:00
parent ee80265097
commit 298b4a07bc

View File

@ -31,14 +31,14 @@ async function readLine(on_key=(key, ctrl, alt, shift, content, pos) => [content
if (pos >= 1) { if (pos >= 1) {
content = content.slice(0, pos - 1) + content.slice(pos) content = content.slice(0, pos - 1) + content.slice(pos)
pos -= 1 pos -= 1
setTerminal(start_terminal.substring(0, terminal_text.length-length) + content) setTerminal(start_terminal + content)
let cursor = getCursor() let cursor = getCursor()
setCursor(cursor[0]-1, cursor[1]) setCursor(cursor[0]-1, cursor[1])
updateTerminalWOCursor() updateTerminalWOCursor()
} }
} else if (event.key == "Delete") { } else if (event.key == "Delete") {
content = content.slice(0, pos) + content.slice(pos + 1) content = content.slice(0, pos) + content.slice(pos + 1)
setTerminal(start_terminal.substring(0, terminal_text.length-length) + content) setTerminal(start_terminal + content)
updateTerminalWOCursor() updateTerminalWOCursor()
} else if (event.key == "ArrowLeft") { } else if (event.key == "ArrowLeft") {
let cursor = getCursor() let cursor = getCursor()