fix cursor starting in wrong spot
This commit is contained in:
parent
5d004370e3
commit
6edffa672b
2
main.js
2
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue