From 43b2f75d6476d56a487d45567fc1e2a9f3eaef32 Mon Sep 17 00:00:00 2001 From: simpuid Date: Wed, 18 Mar 2020 02:22:45 +0530 Subject: Remove update condition from LineEdit::update_placeholder_width Placeholder with length greater than `max_length` are allowed, so there is no reason for those update condition. It fixes the odd alignment of placeholder when it's length is greater than `max_length` --- scene/gui/line_edit.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'scene') diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fdddf0b5fa..8fb61cd311 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1710,13 +1710,11 @@ void LineEdit::update_cached_width() { } void LineEdit::update_placeholder_width() { - if ((max_length <= 0) || (placeholder_translated.length() <= max_length)) { - Ref font = get_font("font"); - cached_placeholder_width = 0; - if (font != NULL) { - for (int i = 0; i < placeholder_translated.length(); i++) { - cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width; - } + Ref font = get_font("font"); + cached_placeholder_width = 0; + if (font != NULL) { + for (int i = 0; i < placeholder_translated.length(); i++) { + cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width; } } } -- cgit v1.2.3