diff options
author | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-06-28 23:51:27 +0000 |
---|---|---|
committer | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-06-28 23:51:27 +0000 |
commit | 0b0767939d4cc0868a10b6c0978f7b2d963dea1a (patch) | |
tree | 0a2e84e94f8ac880c0fffcdf169260716ef2e83e | |
parent | 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8 (diff) | |
download | stable-diffusion-webui-gfx803-0b0767939d4cc0868a10b6c0978f7b2d963dea1a.tar.gz stable-diffusion-webui-gfx803-0b0767939d4cc0868a10b6c0978f7b2d963dea1a.tar.bz2 stable-diffusion-webui-gfx803-0b0767939d4cc0868a10b6c0978f7b2d963dea1a.zip |
Correctly remove end parenthesis with ctrl+up/down
-rw-r--r-- | javascript/edit-attention.js | 5 |
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(); |