aboutsummaryrefslogtreecommitdiff
path: root/javascript/edit-attention.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-07-08 14:41:33 +0300
committerGitHub <noreply@github.com>2023-07-08 14:41:33 +0300
commit953147bf6b5f8de6a0effe3e28013ace0b760f75 (patch)
treeb88d86d79aef332ccf3dfa53a0527f335ca0a4f4 /javascript/edit-attention.js
parenteb51acb89e4c10c08af8649c1fc379552ba41ecc (diff)
parent0b0767939d4cc0868a10b6c0978f7b2d963dea1a (diff)
Merge pull request #11495 from missionfloyd/end-paren-fix
Correctly remove end parenthesis with ctrl+up/down
Diffstat (limited to 'javascript/edit-attention.js')
-rw-r--r--javascript/edit-attention.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/javascript/edit-attention.js b/javascript/edit-attention.js
index ffa73147..8906c892 100644
--- a/javascript/edit-attention.js
+++ b/javascript/edit-attention.js
@@ -100,11 +100,12 @@ function keyupEditAttention(event) {
if (String(weight).length == 1) weight += ".0";
if (closeCharacter == ')' && weight == 1) {
- text = text.slice(0, selectionStart - 1) + text.slice(selectionStart, selectionEnd) + text.slice(selectionEnd + 5);
+ var endParenPos = text.substring(selectionEnd).indexOf(')');
+ text = text.slice(0, selectionStart - 1) + text.slice(selectionStart, selectionEnd) + text.slice(selectionEnd + endParenPos + 1);
selectionStart--;
selectionEnd--;
} else {
- text = text.slice(0, selectionEnd + 1) + weight + text.slice(selectionEnd + 1 + end - 1);
+ text = text.slice(0, selectionEnd + 1) + weight + text.slice(selectionEnd + end);
}
target.focus();