mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibSyntax+TextEditor: Move Highlighter::language_string() out of class
This commit is contained in:
parent
3c2227ceed
commit
b00865bce5
Notes:
sideshowbarker
2024-07-17 06:45:52 +09:00
Author: https://github.com/krkk
Commit: b00865bce5
Pull-request: https://github.com/SerenityOS/serenity/pull/16570
Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 4 additions and 3 deletions
|
@ -872,7 +872,7 @@ void MainWidget::update_statusbar()
|
|||
|
||||
if (m_editor && m_editor->syntax_highlighter()) {
|
||||
auto language = m_editor->syntax_highlighter()->language();
|
||||
m_statusbar->set_text(1, m_editor->syntax_highlighter()->language_string(language));
|
||||
m_statusbar->set_text(1, Syntax::language_to_string(language));
|
||||
}
|
||||
m_statusbar->set_text(2, DeprecatedString::formatted("Ln {}, Col {}", m_editor->cursor().line() + 1, m_editor->cursor().column()));
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ void Highlighter::register_nested_token_pairs(Vector<MatchingTokenPair> pairs)
|
|||
m_nested_token_pairs.set(pair);
|
||||
}
|
||||
|
||||
StringView Highlighter::language_string(Language language) const
|
||||
StringView language_to_string(Language language)
|
||||
{
|
||||
switch (language) {
|
||||
case Language::Cpp:
|
||||
|
|
|
@ -32,6 +32,8 @@ struct TextStyle {
|
|||
bool const bold { false };
|
||||
};
|
||||
|
||||
StringView language_to_string(Language);
|
||||
|
||||
class Highlighter {
|
||||
AK_MAKE_NONCOPYABLE(Highlighter);
|
||||
AK_MAKE_NONMOVABLE(Highlighter);
|
||||
|
@ -40,7 +42,6 @@ public:
|
|||
virtual ~Highlighter() = default;
|
||||
|
||||
virtual Language language() const = 0;
|
||||
StringView language_string(Language) const;
|
||||
virtual Optional<StringView> comment_prefix() const = 0;
|
||||
virtual Optional<StringView> comment_suffix() const = 0;
|
||||
virtual void rehighlight(Palette const&) = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue