diff options
author | Itamar <itamar8910@gmail.com> | 2022-02-07 08:08:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-09 00:51:31 +0100 |
commit | 10d75d7f2199d7d06b2c7a0d8fa8f7dc357ad49b (patch) | |
tree | 3837b1c06e7d145e0d816edb5dc00e902398699c /Userland/Libraries/LibGUI | |
parent | 22f835332a7a72bbe143e857b721659552452b73 (diff) | |
download | serenity-10d75d7f2199d7d06b2c7a0d8fa8f7dc357ad49b.zip |
LibGUI: Add TextEditor::force_rehighlight() method
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 0aeae17aa7..ca30ca3dee 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -1902,6 +1902,11 @@ void TextEditor::rehighlight_if_needed() { if (!m_needs_rehighlight) return; + force_rehighlight(); +} + +void TextEditor::force_rehighlight() +{ if (m_highlighter) m_highlighter->rehighlight(palette()); m_needs_rehighlight = false; @@ -1912,6 +1917,11 @@ Syntax::Highlighter const* TextEditor::syntax_highlighter() const return m_highlighter.ptr(); } +Syntax::Highlighter* TextEditor::syntax_highlighter() +{ + return m_highlighter.ptr(); +} + void TextEditor::set_syntax_highlighter(OwnPtr<Syntax::Highlighter> highlighter) { if (m_highlighter) diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h index 937638bb3d..e42e00b228 100644 --- a/Userland/Libraries/LibGUI/TextEditor.h +++ b/Userland/Libraries/LibGUI/TextEditor.h @@ -175,6 +175,7 @@ public: void set_cursor(size_t line, size_t column); virtual void set_cursor(TextPosition const&); + Syntax::Highlighter* syntax_highlighter(); Syntax::Highlighter const* syntax_highlighter() const; void set_syntax_highlighter(OwnPtr<Syntax::Highlighter>); @@ -209,6 +210,7 @@ public: bool text_is_secret() const { return m_text_is_secret; } void set_text_is_secret(bool text_is_secret); + void force_rehighlight(); protected: explicit TextEditor(Type = Type::MultiLine); |