mirror of
https://github.com/godotengine/godot.git
synced 2024-11-26 22:23:04 +00:00
Merge pull request #88479 from passivestar/lineedit-delete-with-selection
Fix `LineEdit` delete all the way to the left/right when something is selected
This commit is contained in:
commit
a92921ae49
@ -138,8 +138,16 @@ void LineEdit::_backspace(bool p_word, bool p_all_to_left) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.enabled) {
|
||||
selection_delete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (caret_column == 0) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
|
||||
if (p_all_to_left) {
|
||||
deselect();
|
||||
text = text.substr(caret_column);
|
||||
_shape();
|
||||
set_caret_column(0);
|
||||
@ -147,11 +155,6 @@ void LineEdit::_backspace(bool p_word, bool p_all_to_left) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.enabled) {
|
||||
selection_delete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_word) {
|
||||
int cc = caret_column;
|
||||
|
||||
@ -176,25 +179,22 @@ void LineEdit::_delete(bool p_word, bool p_all_to_right) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_all_to_right) {
|
||||
deselect();
|
||||
text = text.substr(0, caret_column);
|
||||
_shape();
|
||||
_text_changed();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.enabled) {
|
||||
selection_delete();
|
||||
return;
|
||||
}
|
||||
|
||||
int text_len = text.length();
|
||||
|
||||
if (caret_column == text_len) {
|
||||
if (caret_column == text.length()) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
|
||||
if (p_all_to_right) {
|
||||
text = text.substr(0, caret_column);
|
||||
_shape();
|
||||
_text_changed();
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_word) {
|
||||
int cc = caret_column;
|
||||
PackedInt32Array words = TS->shaped_text_get_word_breaks(text_rid);
|
||||
|
Loading…
Reference in New Issue
Block a user