From 6a1fdc213c673360a9488bb976700e1e289059a9 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 8 Sep 2023 08:58:51 +0300 Subject: [PATCH] [LineEdit] Update line edit offset on text delete. --- scene/gui/line_edit.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 4c1e591bd78..f74d6df1584 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -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); _shape(); - caret_column -= CLAMP(caret_column - p_from_column, 0, p_to_column - p_from_column); - - if (caret_column >= text.length()) { - caret_column = text.length(); - } + set_caret_column(caret_column - CLAMP(caret_column - p_from_column, 0, p_to_column - p_from_column)); if (!text_changed_dirty) { if (is_inside_tree()) {