kbmulti - Fix space and backspace when not at end of text

master
Martin Boonk 2022-07-03 19:32:02 +02:00
parent 2b3b451ec7
commit 54232adbe8
1 changed files with 6 additions and 4 deletions

View File

@ -73,10 +73,12 @@ exports.input = function(options) {
function backspace() {
deactivateTimeout(charTimeout);
text = text.slice(0, -1);
if (textIndex > -1){
text = text.slice(0, textIndex) + text.slice(textIndex + 1);
if (textIndex > -1) textIndex --;
newCharacter();
}
}
function setCaps() {
caps = !caps;
@ -126,7 +128,7 @@ exports.input = function(options) {
displayText(false);
} else if (dirLeftRight == 1) {
if (!moveMode){
text += ' ';
text = text.slice(0, textIndex + 1) + " " + text.slice(++textIndex);
newCharacter();
} else {
if (textIndex < text.length) textIndex++;