From b663a825a68e6fb375a2c1c33d5cb1252606856c Mon Sep 17 00:00:00 2001 From: Eduard Zalyaev Date: Tue, 29 Nov 2022 00:02:08 +0300 Subject: [PATCH] Script editor: Fix edge case when double-click incorrectly updates caret position Fixes #68898. --- scene/gui/text_edit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index cce9fa4f345..e7d704a281b 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7038,8 +7038,8 @@ void TextEdit::_update_selection_mode_word() { if ((col <= carets[caret_idx].selection.selected_word_origin && line == get_selection_line(caret_idx)) || line < get_selection_line(caret_idx)) { carets.write[caret_idx].selection.selecting_column = carets[caret_idx].selection.selected_word_end; select(line, beg, get_selection_line(caret_idx), carets[caret_idx].selection.selected_word_end, caret_idx); - set_caret_line(get_selection_from_line(caret_idx), false, true, 0, caret_idx); - set_caret_column(get_selection_from_column(caret_idx), true, caret_idx); + set_caret_line(line, false, true, 0, caret_idx); + set_caret_column(beg, true, caret_idx); } else { carets.write[caret_idx].selection.selecting_column = carets[caret_idx].selection.selected_word_beg; select(get_selection_line(caret_idx), carets[caret_idx].selection.selected_word_beg, line, end, caret_idx);