Merge pull request #88057 from passivestar/cmd-backspace-lineedit

Fix LineEdit behavior for deleting all the way to the left/right
This commit is contained in:
Rémi Verschelde 2024-02-13 17:24:18 +01:00
commit 768ab25562
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -140,7 +140,9 @@ void LineEdit::_backspace(bool p_word, bool p_all_to_left) {
if (p_all_to_left) {
deselect();
text = text.substr(0, caret_column);
text = text.substr(caret_column);
_shape();
set_caret_column(0);
_text_changed();
return;
}
@ -176,9 +178,8 @@ void LineEdit::_delete(bool p_word, bool p_all_to_right) {
if (p_all_to_right) {
deselect();
text = text.substr(caret_column, text.length() - caret_column);
text = text.substr(0, caret_column);
_shape();
set_caret_column(0);
_text_changed();
return;
}