mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
TextEditor: Hookup git commit message detection and highlighting
This commit is contained in:
parent
8e8d24fe29
commit
974e36e7a9
Notes:
sideshowbarker
2024-07-17 20:41:16 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/974e36e7a9f Pull-request: https://github.com/SerenityOS/serenity/pull/11985
2 changed files with 11 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
#include <LibGUI/FilePicker.h>
|
||||
#include <LibGUI/FontPicker.h>
|
||||
#include <LibGUI/GMLSyntaxHighlighter.h>
|
||||
#include <LibGUI/GitCommitSyntaxHighlighter.h>
|
||||
#include <LibGUI/GroupBox.h>
|
||||
#include <LibGUI/INISyntaxHighlighter.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
|
@ -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<GUI::GitCommitSyntaxHighlighter>());
|
||||
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<GUI::GMLSyntaxHighlighter>());
|
||||
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") {
|
||||
|
|
|
@ -119,6 +119,7 @@ private:
|
|||
RefPtr<GUI::Action> m_css_highlight;
|
||||
RefPtr<GUI::Action> m_js_highlight;
|
||||
RefPtr<GUI::Action> m_html_highlight;
|
||||
RefPtr<GUI::Action> m_git_highlight;
|
||||
RefPtr<GUI::Action> m_gml_highlight;
|
||||
RefPtr<GUI::Action> m_ini_highlight;
|
||||
RefPtr<GUI::Action> m_shell_highlight;
|
||||
|
|
Loading…
Reference in a new issue