diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 039c5f70471..5ec40b832fa 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -586,6 +587,13 @@ void MainWidget::initialize_menubar(GUI::Window& window) syntax_actions.add_action(*m_html_highlight); syntax_menu.add_action(*m_html_highlight); + m_git_highlight = GUI::Action::create_checkable("Git Commit", [&](auto&) { + m_editor->set_syntax_highlighter(make()); + m_editor->update(); + }); + syntax_actions.add_action(*m_git_highlight); + syntax_menu.add_action(*m_git_highlight); + m_gml_highlight = GUI::Action::create_checkable("&GML", [&](auto&) { m_editor->set_syntax_highlighter(make()); m_editor->update(); @@ -639,6 +647,8 @@ void MainWidget::set_path(StringView path) m_cpp_highlight->activate(); } else if (m_extension == "js" || m_extension == "mjs" || m_extension == "json") { m_js_highlight->activate(); + } else if (m_name == "COMMIT_EDITMSG") { + m_git_highlight->activate(); } else if (m_extension == "gml") { m_gml_highlight->activate(); } else if (m_extension == "ini" || m_extension == "af") { diff --git a/Userland/Applications/TextEditor/MainWidget.h b/Userland/Applications/TextEditor/MainWidget.h index 5c81fec443a..b61289eb9be 100644 --- a/Userland/Applications/TextEditor/MainWidget.h +++ b/Userland/Applications/TextEditor/MainWidget.h @@ -119,6 +119,7 @@ private: RefPtr m_css_highlight; RefPtr m_js_highlight; RefPtr m_html_highlight; + RefPtr m_git_highlight; RefPtr m_gml_highlight; RefPtr m_ini_highlight; RefPtr m_shell_highlight;