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`

(cherry picked from commit 43b2f75d64)
This commit is contained in:
simpuid 2020-03-18 02:22:45 +05:30 committed by Rémi Verschelde
parent 53c8d8a5fb
commit 223d0abd7e
1 changed files with 5 additions and 7 deletions

View File

@ -1687,13 +1687,11 @@ void LineEdit::update_cached_width() {
} }
void LineEdit::update_placeholder_width() { void LineEdit::update_placeholder_width() {
if ((max_length <= 0) || (placeholder_translated.length() <= max_length)) { Ref<Font> font = get_font("font");
Ref<Font> font = get_font("font"); cached_placeholder_width = 0;
cached_placeholder_width = 0; if (font != NULL) {
if (font != NULL) { for (int i = 0; i < placeholder_translated.length(); i++) {
for (int i = 0; i < placeholder_translated.length(); i++) { cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width;
cached_placeholder_width += font->get_char_size(placeholder_translated[i]).width;
}
} }
} }
} }