From 7133f442287c326fa7af78a55900bc264656a827 Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 3 Mar 2025 15:58:58 +0100 Subject: [PATCH] Fix caret_force_displayed (cherry picked from commit 6d2f18c6c6c9b0415da4d2daed2b75e21a62c350) --- doc/classes/LineEdit.xml | 2 +- scene/gui/line_edit.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index c6cdacb6ec..879b179dbf 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -252,7 +252,7 @@ The caret's column position inside the [LineEdit]. When set, the text may scroll to accommodate it. - If [code]true[/code], the [LineEdit] will always show the caret, even if focus is lost. + If [code]true[/code], the [LineEdit] will always show the caret, even if not editing or focus is lost. Allow moving caret, selecting and removing the individual composite character components. diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 969e2fd3a3..f4d66d5a28 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1733,7 +1733,7 @@ void LineEdit::_validate_caret_can_draw() { draw_caret = true; caret_blink_timer = 0.0; } - caret_can_draw = editing && (window_has_focus || (menu && menu->has_focus())) && (has_focus() || caret_force_displayed); + caret_can_draw = (caret_force_displayed && !is_part_of_edited_scene()) || (editing && (window_has_focus || (menu && menu->has_focus())) && has_focus()); } void LineEdit::delete_char() {