Merge pull request #15178 from catboxanon/feat/edit-attention-whitespace-trim

edit-attention: deselect surrounding whitespace
This commit is contained in:
AUTOMATIC1111 2024-03-08 06:21:24 +03:00 committed by GitHub
commit 8b96f3d036
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}