summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/gui/text_edit.cpp8
-rw-r--r--scene/gui/text_edit.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7577ee22ab..852eed1768 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -549,16 +549,17 @@ void TextEdit::_notification(int p_what) {
MessageQueue::get_singleton()->push_call(this, "_cursor_changed_emit");
if (text_changed_dirty)
MessageQueue::get_singleton()->push_call(this, "_text_changed_emit");
- update_wrap_at();
+ _update_wrap_at();
} break;
case NOTIFICATION_RESIZED: {
_update_scrollbars();
- update_wrap_at();
+ call_deferred("_update_wrap_at");
} break;
case NOTIFICATION_THEME_CHANGED: {
_update_caches();
+ _update_wrap_at();
} break;
case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
window_has_focus = true;
@@ -3643,7 +3644,7 @@ int TextEdit::get_total_visible_rows() const {
return total_rows;
}
-void TextEdit::update_wrap_at() {
+void TextEdit::_update_wrap_at() {
wrap_at = get_size().width - cache.style_normal->get_minimum_size().width - cache.line_number_w - cache.breakpoint_gutter_width - cache.fold_gutter_width - wrap_right_offset;
update_cursor_wrap_offset();
@@ -6091,6 +6092,7 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("_click_selection_held"), &TextEdit::_click_selection_held);
ClassDB::bind_method(D_METHOD("_toggle_draw_caret"), &TextEdit::_toggle_draw_caret);
ClassDB::bind_method(D_METHOD("_v_scroll_input"), &TextEdit::_v_scroll_input);
+ ClassDB::bind_method(D_METHOD("_update_wrap_at"), &TextEdit::_update_wrap_at);
BIND_ENUM_CONSTANT(SEARCH_MATCH_CASE);
BIND_ENUM_CONSTANT(SEARCH_WHOLE_WORDS);
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index bfe769a402..95f1fbbee5 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -336,7 +336,7 @@ private:
int get_total_visible_rows() const;
void update_cursor_wrap_offset();
- void update_wrap_at();
+ void _update_wrap_at();
bool line_wraps(int line) const;
int times_line_wraps(int line) const;
Vector<String> get_wrap_rows_text(int p_line) const;