aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/edit-attention.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-07-19 04:59:39 +0000
committerGitHub <noreply@github.com>2023-07-19 04:59:39 +0000
commit0a334b447ff0c41519bb9e280050736913ad9cf8 (patch)
treee27963f76b7357ff0cb7b2c3fdcb720ab64f0e50 /javascript/edit-attention.js
parent6094310704f4b3853bfa5d05d9c1ace58b2deee7 (diff)
parentc2b975485708791b29d44d79ee1a48d3abd838b7 (diff)
downloadstable-diffusion-webui-gfx803-0a334b447ff0c41519bb9e280050736913ad9cf8.tar.gz
stable-diffusion-webui-gfx803-0a334b447ff0c41519bb9e280050736913ad9cf8.tar.bz2
stable-diffusion-webui-gfx803-0a334b447ff0c41519bb9e280050736913ad9cf8.zip
Merge branch 'dev' into allow-no-venv-install
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();