From 54ced5539cebb76ffc0f894da00fd7720bc31d73 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 12 Jul 2021 01:02:41 +0100 Subject: [PATCH] missing escape character causing issues with ctrl backspace and numbers fixed #1620 --- src/js/input-controller.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/input-controller.js b/src/js/input-controller.js index 272e1e3d7..b7a5639fa 100644 --- a/src/js/input-controller.js +++ b/src/js/input-controller.js @@ -167,7 +167,7 @@ function handleBackspace(event) { // } if ( - /^[ £§`~!@#$%^&*()_+-=[\]{};':"|,./<>?]*$/g.test( + /^[ £§`~!@#$%^&*()_+\-=[\]{};':"|,./<>?]*$/g.test( TestLogic.input.getCurrent() ) ) { @@ -186,20 +186,22 @@ function handleBackspace(event) { TestLogic.input.popHistory(); TestLogic.corrected.popHistory(); } else { - const regex = new RegExp(/[ £§`~!@#$%^&*()_+-=[\]{};':"|,./<>?]/, "g"); + const regex = new RegExp(/[ £§`~!@#$%^&*()_+\-=[\]{};':"|,./<>?]/, "g"); let input = TestLogic.input.getCurrent(); regex.test(input); // let puncIndex = regex.lastIndex; let puncIndex = input.lastIndexOfRegex( - /[ £§`~!@#$%^&*()_+-=[\]{};':"|,./<>?]/g + /[ £§`~!@#$%^&*()_+\-=[\]{};':"|,./<>?]/g ); - while (/[ £§`~!@#$%^&*()_+-=[\]{};':"|,./<>?]/g.test(input.slice(-1))) { + while ( + /[ £§`~!@#$%^&*()_+\-=[\]{};':"|,./<>?]/g.test(input.slice(-1)) + ) { input = input.substring(0, input.length - 1); } puncIndex = input.lastIndexOfRegex( - /[ £§`~!@#$%^&*()_+-=[\]{};':"|,./<>?]/g + /[ £§`~!@#$%^&*()_+\-=[\]{};':"|,./<>?]/g ); TestLogic.input.setCurrent(input.substring(0, puncIndex + 1)); }