diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 08c13e7bc..36039130c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -4105,7 +4105,7 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i text_changed_dirty = true; } - emit_signal("line_edited_from", p_line); + emit_signal("lines_edited_from", p_line, r_end_line); } String TextEdit::_base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const { @@ -4169,7 +4169,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li text_changed_dirty = true; } - emit_signal("line_edited_from", p_from_line); + emit_signal("lines_edited_from", p_to_line, p_from_line); } void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_char) { @@ -7353,7 +7353,7 @@ void TextEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("cursor_changed")); ADD_SIGNAL(MethodInfo("text_changed")); - ADD_SIGNAL(MethodInfo("line_edited_from", PropertyInfo(Variant::INT, "line"))); + ADD_SIGNAL(MethodInfo("lines_edited_from", PropertyInfo(Variant::INT, "from_line"), PropertyInfo(Variant::INT, "to_line"))); ADD_SIGNAL(MethodInfo("request_completion")); ADD_SIGNAL(MethodInfo("breakpoint_toggled", PropertyInfo(Variant::INT, "row"))); ADD_SIGNAL(MethodInfo("symbol_lookup", PropertyInfo(Variant::STRING, "symbol"), PropertyInfo(Variant::INT, "row"), PropertyInfo(Variant::INT, "column"))); diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp index 70d37b7fe..a31c8070b 100644 --- a/scene/resources/syntax_highlighter.cpp +++ b/scene/resources/syntax_highlighter.cpp @@ -53,13 +53,13 @@ Dictionary SyntaxHighlighter::get_line_syntax_highlighting(int p_line) { return color_map; } -void SyntaxHighlighter::_line_edited_from(int p_line) { +void SyntaxHighlighter::_lines_edited_from(int p_from_line, int p_to_line) { if (highlighting_cache.size() < 1) { return; } int cache_size = highlighting_cache.back()->key(); - for (int i = p_line - 1; i <= cache_size; i++) { + for (int i = MIN(p_from_line, p_to_line) - 1; i <= cache_size; i++) { if (highlighting_cache.has(i)) { highlighting_cache.erase(i); } @@ -97,7 +97,7 @@ void SyntaxHighlighter::update_cache() { void SyntaxHighlighter::set_text_edit(TextEdit *p_text_edit) { if (text_edit && ObjectDB::get_instance(text_edit_instance_id)) { - text_edit->disconnect("line_edited_from", this, "_line_edited_from"); + text_edit->disconnect("lines_edited_from", this, "_lines_edited_from"); } text_edit = p_text_edit; @@ -105,7 +105,7 @@ void SyntaxHighlighter::set_text_edit(TextEdit *p_text_edit) { return; } text_edit_instance_id = text_edit->get_instance_id(); - text_edit->connect("line_edited_from", this, "_line_edited_from"); + text_edit->connect("lines_edited_from", this, "_lines_edited_from"); update_cache(); } @@ -128,7 +128,7 @@ void SyntaxHighlighter::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_cache"), &SyntaxHighlighter::_update_cache); ClassDB::bind_method(D_METHOD("_clear_highlighting_cache"), &SyntaxHighlighter::_clear_highlighting_cache); - ClassDB::bind_method(D_METHOD("_line_edited_from"), &SyntaxHighlighter::_line_edited_from); + ClassDB::bind_method(D_METHOD("_lines_edited_from"), &SyntaxHighlighter::_lines_edited_from); BIND_VMETHOD(MethodInfo(Variant::DICTIONARY, "_get_line_syntax_highlighting", PropertyInfo(Variant::INT, "p_line"))); BIND_VMETHOD(MethodInfo("_update_cache")); diff --git a/scene/resources/syntax_highlighter.h b/scene/resources/syntax_highlighter.h index 8ab5cd00a..c46e87a76 100644 --- a/scene/resources/syntax_highlighter.h +++ b/scene/resources/syntax_highlighter.h @@ -62,7 +62,7 @@ protected: private: RBMap highlighting_cache; - void _line_edited_from(int p_line); + void _lines_edited_from(int p_from_line, int p_to_line); }; ///////////////////////////////////////////////////////////////////////////////