mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +00:00
LibGUI: Abstract token pair matching
This commit is contained in:
parent
ac524b632f
commit
c02037e944
Notes:
sideshowbarker
2024-07-19 08:19:37 +09:00
Author: https://github.com/oriko1010
Commit: c02037e944
Pull-request: https://github.com/SerenityOS/serenity/pull/1435
4 changed files with 124 additions and 105 deletions
|
@ -8,7 +8,13 @@ namespace GUI {
|
|||
|
||||
enum class SyntaxLanguage {
|
||||
PlainText,
|
||||
Cpp
|
||||
Cpp,
|
||||
Javascript
|
||||
};
|
||||
|
||||
struct TextStyle {
|
||||
Color color;
|
||||
const Gfx::Font* font { nullptr };
|
||||
};
|
||||
|
||||
class SyntaxHighlighter {
|
||||
|
@ -20,7 +26,7 @@ public:
|
|||
|
||||
virtual SyntaxLanguage language() const = 0;
|
||||
virtual void rehighlight() = 0;
|
||||
virtual void highlight_matching_token_pair() = 0;
|
||||
virtual void highlight_matching_token_pair();
|
||||
|
||||
virtual bool is_identifier(void*) const { return false; };
|
||||
virtual bool is_navigatable(void*) const { return false; };
|
||||
|
@ -34,6 +40,14 @@ protected:
|
|||
|
||||
WeakPtr<TextEditor> m_editor;
|
||||
|
||||
struct MatchingTokenPair {
|
||||
void* open;
|
||||
void* close;
|
||||
};
|
||||
|
||||
virtual Vector<MatchingTokenPair> matching_token_pairs() const = 0;
|
||||
virtual bool token_types_equal(void*, void*) const = 0;
|
||||
|
||||
struct BuddySpan {
|
||||
int index { -1 };
|
||||
GUI::TextDocumentSpan span_backup;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue