Merge pull request #81443 from bruvzg/le_off_del

[LineEdit] Update line edit offset on text delete.
This commit is contained in:
Rémi Verschelde 2023-09-08 11:50:49 +02:00
commit baad99220e
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1513,11 +1513,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) {
text = text.left(p_from_column) + text.substr(p_to_column); text = text.left(p_from_column) + text.substr(p_to_column);
_shape(); _shape();
caret_column -= CLAMP(caret_column - p_from_column, 0, p_to_column - p_from_column); set_caret_column(caret_column - CLAMP(caret_column - p_from_column, 0, p_to_column - p_from_column));
if (caret_column >= text.length()) {
caret_column = text.length();
}
if (!text_changed_dirty) { if (!text_changed_dirty) {
if (is_inside_tree()) { if (is_inside_tree()) {