diff options
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r-- | scene/gui/text_edit.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 3f1b9fc981..6e5f7f0787 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -764,7 +764,7 @@ void TextEdit::_notification(int p_what) { } } - bool draw_placeholder = text.size() == 1 && text[0].is_empty() && ime_text.is_empty(); + bool draw_placeholder = _using_placeholder(); // Get the highlighted words. String highlighted_text = get_selected_text(0); @@ -2849,6 +2849,10 @@ void TextEdit::_update_placeholder() { } } +bool TextEdit::_using_placeholder() const { + return text.size() == 1 && text[0].is_empty() && ime_text.is_empty(); +} + void TextEdit::_update_theme_item_cache() { Control::_update_theme_item_cache(); @@ -7840,10 +7844,10 @@ void TextEdit::_update_scrollbars() { h_scroll->set_begin(Point2(0, size.height - hmin.height)); h_scroll->set_end(Point2(size.width - vmin.width, size.height)); - bool draw_placeholder = text.size() == 1 && text[0].length() == 0; + bool draw_placeholder = _using_placeholder(); int visible_rows = get_visible_line_count(); - int total_rows = draw_placeholder ? placeholder_wraped_rows.size() - 1 : get_total_visible_line_count(); + int total_rows = draw_placeholder ? placeholder_wraped_rows.size() : get_total_visible_line_count(); if (scroll_past_end_of_file_enabled && !fit_content_height) { total_rows += visible_rows - 1; } @@ -7921,7 +7925,7 @@ void TextEdit::_scroll_moved(double p_to_val) { } if (v_scroll->is_visible_in_tree()) { // Set line ofs and wrap ofs. - bool draw_placeholder = text.size() == 1 && text[0].length() == 0; + bool draw_placeholder = _using_placeholder(); int v_scroll_i = floor(get_v_scroll()); int sc = 0; |