diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-01-05 18:22:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-05 18:22:43 +0100 |
commit | c1f6852a6a3b2ca0186376433e12cb181a6f2c15 (patch) | |
tree | b5543752dc371ed477ff247bda9a76a262da0680 /scene | |
parent | 021421e1808d68e7fb6d87ed027d3dc454b3291e (diff) | |
parent | 411df08711dfae526b75b3937ec65f497a3bcb01 (diff) |
Merge pull request #24792 from Paulb23/wrap_zoom_issue_23896
Fix text edit wrapping beyond control size, issue 23896
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/text_edit.cpp | 8 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 2 |
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; |