From d8886e1a0cde6b1bed8de5a8c8e697267633f4be Mon Sep 17 00:00:00 2001 From: Igorrreha Date: Fri, 26 May 2023 15:51:32 +0700 Subject: [PATCH] Fix LineEdit expanding to text length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix for issue #77474 Remove wrong tab Change the comment to more relevant Co-authored-by: RĂ©mi Verschelde --- scene/gui/line_edit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index d65f94340b6..cf2bbcb0a19 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1776,8 +1776,8 @@ Size2 LineEdit::get_minimum_size() const { min_size.width = theme_cache.minimum_character_width * em_space_size; if (expand_to_text_length) { - // Add a space because some fonts are too exact, and because caret needs a bit more when at the end. - min_size.width = MAX(min_size.width, full_width + em_space_size); + // Ensure some space for the caret when placed at the end. + min_size.width = MAX(min_size.width, full_width + theme_cache.caret_width); } min_size.height = MAX(TS->shaped_text_get_size(text_rid).y, font->get_height(font_size));