diff --git a/main.js b/main.js index 25f0667..7a80389 100644 --- a/main.js +++ b/main.js @@ -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);