diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2022-01-17 19:36:09 -0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-18 09:01:16 +0100 |
commit | 8e8d24fe29ac5070504e911821e382644ebfa5c9 (patch) | |
tree | a37984f2657b703b391170d7cab77d7271c9f4bf /Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h | |
parent | d32736582e5d067a01badc417a9ad3544e4854f2 (diff) | |
download | serenity-8e8d24fe29ac5070504e911821e382644ebfa5c9.zip |
LibGUI: Add a GitCommit SyntaxHighlighter implementation
This highlighter just syntax highlights the commented lines in your git
commit message. It could potentially be enhanced to handle the rebase
UI or other more advanced cases in the future.
Diffstat (limited to 'Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h')
-rw-r--r-- | Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h b/Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h new file mode 100644 index 0000000000..3e9cec60a7 --- /dev/null +++ b/Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022, Brian Gianforcaro <bgianf@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <LibSyntax/Highlighter.h> + +namespace GUI { + +class GitCommitSyntaxHighlighter final : public Syntax::Highlighter { +public: + GitCommitSyntaxHighlighter() { } + virtual ~GitCommitSyntaxHighlighter() override; + + virtual Syntax::Language language() const override { return Syntax::Language::GitCommit; } + virtual void rehighlight(Palette const&) override; + +protected: + virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override; + virtual bool token_types_equal(u64, u64) const override; +}; + +} |