mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
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.
This commit is contained in:
parent
d32736582e
commit
8e8d24fe29
Notes:
sideshowbarker
2024-07-18 00:54:03 +09:00
Author: https://github.com/bgianfo
Commit: 8e8d24fe29
Pull-request: https://github.com/SerenityOS/serenity/pull/11985
5 changed files with 231 additions and 0 deletions
26
Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h
Normal file
26
Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h
Normal file
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue