Skip to content

Commit

Permalink
Merge pull request #15178 from catboxanon/feat/edit-attention-whitesp…
Browse files Browse the repository at this point in the history
…ace-trim

edit-attention: deselect surrounding whitespace
  • Loading branch information
AUTOMATIC1111 authored Mar 8, 2024
2 parents 58f7410 + 5ab5405 commit 8b96f3d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions javascript/edit-attention.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ function keyupEditAttention(event) {
selectionEnd++;
}

// deselect surrounding whitespace
while (text[selectionStart] == " " && selectionStart < selectionEnd) {
selectionStart++;
}
while (text[selectionEnd - 1] == " " && selectionEnd > selectionStart) {
selectionEnd--;
}

target.setSelectionRange(selectionStart, selectionEnd);
return true;
}
Expand Down

0 comments on commit 8b96f3d

Please sign in to comment.