From 82e8c7a42cb9bf32d139e2787440cd1831c480e1 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 24 Feb 2021 16:50:00 +0000 Subject: [PATCH] fixed dash limited words not working with ctrl backspace --- src/js/script.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index 352c33d8f..263a11b0e 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -5317,19 +5317,23 @@ function handleBackspace(event) { } else { if (config.confidenceMode === "max") return; if (event["ctrlKey"] || event["altKey"]) { - let split = currentInput.replace(/ +/g, " ").split(" "); + let limiter = " "; + if (currentInput.lastIndexOf("-") > currentInput.lastIndexOf(" ")) + limiter = "-"; + + let split = currentInput.replace(/ +/g, " ").split(limiter); if (split[split.length - 1] == "") { split.pop(); } - let addspace = false; + let addlimiter = false; if (split.length > 1) { - addspace = true; + addlimiter = true; } split.pop(); - currentInput = split.join(" "); + currentInput = split.join(limiter); - if (addspace) { - currentInput += " "; + if (addlimiter) { + currentInput += limiter; } } else if (event.metaKey) { currentInput = "";