fix cursor starting in wrong spot

This commit is contained in:
filifa
2025-12-11 23:49:34 -05:00
parent 5d004370e3
commit 6edffa672b

View File

@@ -175,7 +175,7 @@ function keyPress(c) {
const begin = currentInput.value.slice(0, selectionStart);
const end = currentInput.value.slice(selectionEnd);
currentInput.value = begin + c + end;
currentInput.setSelectionRange(selectionEnd+1, selectionEnd+1);
currentInput.setSelectionRange(selectionStart+1, selectionStart+1);
}
document.querySelector("#expr").addEventListener("focus", setCurrentInput);