From f1c69477020097ae3a64c43fd33f029e5fa146c8 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Tue, 18 Dec 2018 13:01:15 +0000 Subject: Fix Word wrap cache desync causing crash --- scene/gui/text_edit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index fef29b7e6c..b1849b7e69 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -846,9 +846,9 @@ void TextEdit::_notification(int p_what) { bool underlined = false; + Vector wrap_rows = get_wrap_rows_text(line); int line_wrap_amount = times_line_wraps(line); int last_wrap_column = 0; - Vector wrap_rows = get_wrap_rows_text(line); for (int line_wrap_index = 0; line_wrap_index < line_wrap_amount + 1; line_wrap_index++) { if (line_wrap_index != 0) { @@ -3816,6 +3816,10 @@ Vector TextEdit::get_wrap_rows_text(int p_line) const { // line ends before hit wrap_at; add this word to the substring wrap_substring += word_str; lines.push_back(wrap_substring); + + // update cache + text.set_line_wrap_amount(p_line, lines.size() - 1); + return lines; } -- cgit v1.2.3