Merge pull request #32940 from nekomatata/text-edit-clear-colors
TextEdit syntax highlighting fixes
This commit is contained in:
commit
9f28803927
@ -54,7 +54,7 @@
|
|||||||
<return type="void">
|
<return type="void">
|
||||||
</return>
|
</return>
|
||||||
<description>
|
<description>
|
||||||
Clears all the syntax coloring information.
|
Clears all custom syntax coloring information previously added with [method add_color_region] or [method add_keyword_color].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="clear_undo_history">
|
<method name="clear_undo_history">
|
||||||
|
@ -5063,15 +5063,18 @@ Map<int, TextEdit::Text::ColorRegionInfo> TextEdit::_get_line_color_region_info(
|
|||||||
void TextEdit::clear_colors() {
|
void TextEdit::clear_colors() {
|
||||||
|
|
||||||
keywords.clear();
|
keywords.clear();
|
||||||
|
member_keywords.clear();
|
||||||
color_regions.clear();
|
color_regions.clear();
|
||||||
color_region_cache.clear();
|
color_region_cache.clear();
|
||||||
syntax_highlighting_cache.clear();
|
syntax_highlighting_cache.clear();
|
||||||
text.clear_width_cache();
|
text.clear_width_cache();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEdit::add_keyword_color(const String &p_keyword, const Color &p_color) {
|
void TextEdit::add_keyword_color(const String &p_keyword, const Color &p_color) {
|
||||||
|
|
||||||
keywords[p_keyword] = p_color;
|
keywords[p_keyword] = p_color;
|
||||||
|
syntax_highlighting_cache.clear();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5088,12 +5091,14 @@ Color TextEdit::get_keyword_color(String p_keyword) const {
|
|||||||
void TextEdit::add_color_region(const String &p_begin_key, const String &p_end_key, const Color &p_color, bool p_line_only) {
|
void TextEdit::add_color_region(const String &p_begin_key, const String &p_end_key, const Color &p_color, bool p_line_only) {
|
||||||
|
|
||||||
color_regions.push_back(ColorRegion(p_begin_key, p_end_key, p_color, p_line_only));
|
color_regions.push_back(ColorRegion(p_begin_key, p_end_key, p_color, p_line_only));
|
||||||
|
syntax_highlighting_cache.clear();
|
||||||
text.clear_width_cache();
|
text.clear_width_cache();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEdit::add_member_keyword(const String &p_keyword, const Color &p_color) {
|
void TextEdit::add_member_keyword(const String &p_keyword, const Color &p_color) {
|
||||||
member_keywords[p_keyword] = p_color;
|
member_keywords[p_keyword] = p_color;
|
||||||
|
syntax_highlighting_cache.clear();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5107,6 +5112,7 @@ Color TextEdit::get_member_color(String p_member) const {
|
|||||||
|
|
||||||
void TextEdit::clear_member_keywords() {
|
void TextEdit::clear_member_keywords() {
|
||||||
member_keywords.clear();
|
member_keywords.clear();
|
||||||
|
syntax_highlighting_cache.clear();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user