summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimpuid <utkarsh.email@yahoo.com>2020-03-18 02:22:45 +0530
committersimpuid <utkarsh.email@yahoo.com>2020-03-18 02:22:45 +0530
commit43b2f75d6476d56a487d45567fc1e2a9f3eaef32 (patch)
tree4ccaf83e733b7c79f0d2daf6d340f63e0ddbcea9
parent989a223c5a6d6ba5b1b098be8983888cb49b2525 (diff)
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`
-rw-r--r--scene/gui/line_edit.cpp12
1 files changed, 5 insertions, 7 deletions
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> 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> 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;
}
}
}