فهرست منبع

Merge pull request #77507 from Igorrreha/fix/line-edit-expanding-to-text

Fix LineEdit expanding to text length
Rémi Verschelde 2 سال پیش
والد
کامیت
df30c9d6e7
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      scene/gui/line_edit.cpp

+ 2 - 2
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));