mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 16:33:13 +00:00
HackStudio+LibGUI: Implement matching curly brace highlighting
This works for C++ syntax highlighted text documents by caching the C++ token type in a new "arbitrary data" member of GTextDocumentSpan. When the cursor is placed immediately before a '{' or immediately after a '}', we highlight both of these brace buddies by changing their corresponding spans to have a different background color. ..and spans can also now have a custom background color. :^)
This commit is contained in:
parent
5f7f97355e
commit
c8e02e60a6
Notes:
sideshowbarker
2024-07-19 11:09:13 +09:00
Author: https://github.com/awesomekling
Commit: c8e02e60a6
6 changed files with 89 additions and 1 deletions
|
@ -423,7 +423,7 @@ int main(int argc, char** argv)
|
|||
remove_current_editor_action->set_enabled(g_all_editor_wrappers.size() > 1);
|
||||
};
|
||||
|
||||
open_file("test.frm");
|
||||
open_file("main.cpp");
|
||||
|
||||
update_actions();
|
||||
return app.exec();
|
||||
|
@ -484,6 +484,7 @@ static void rehighlight()
|
|||
span.color = style.color;
|
||||
span.font = style.font;
|
||||
span.is_skippable = token.m_type == CppToken::Type::Whitespace;
|
||||
span.data = (void*)token.m_type;
|
||||
spans.append(span);
|
||||
}
|
||||
current_editor().document().set_spans(spans);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue