Fix removeInput

This commit is contained in:
Lukáš Ondrejka 2024-10-13 19:46:52 +02:00
parent 48ccc27b9f
commit d51cc39711

View file

@ -154,10 +154,12 @@ export default {
}, },
removeInput() { removeInput() {
const backspaceCount = 2 * this.terminalInputBuffer.length - this.cursorPosition; const textAfterCursorLength = this.terminalInputBuffer.length - this.cursorPosition;
const spaces = " ".repeat(textAfterCursorLength);
const backspaceCount = this.terminalInputBuffer.length;
const backspaces = "\b \b".repeat(backspaceCount); const backspaces = "\b \b".repeat(backspaceCount);
this.cursorPosition = 0; this.cursorPosition = 0;
this.terminal.write(backspaces); this.terminal.write(spaces + backspaces);
this.terminalInputBuffer = ""; this.terminalInputBuffer = "";
}, },