1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 02:05:06 +00:00

LibGfx: Add Gfx::TextAttributes (and use it in GUI::TextDocumentSpan)

This commit is contained in:
Andreas Kling 2021-01-02 20:31:45 +01:00
parent 0d44ee6f2b
commit 05f5d0dda3
11 changed files with 127 additions and 83 deletions

View file

@ -47,23 +47,29 @@ void CellSyntaxHighlighter::rehighlight(Gfx::Palette palette)
// Highlight the '='
m_editor->document().spans().empend(
GUI::TextRange { { 0, 0 }, { 0, 1 } },
palette.syntax_keyword(),
Optional<Color> {},
false,
false,
false,
nullptr);
Gfx::TextAttributes {
palette.syntax_keyword(),
Optional<Color> {},
false,
false,
},
nullptr,
false);
if (m_cell && m_cell->exception()) {
auto range = m_cell->exception()->source_ranges().first();
GUI::TextRange text_range { { range.start.line - 1, range.start.column }, { range.end.line - 1, range.end.column - 1 } };
m_editor->document().spans().prepend({ text_range,
Color::Black,
Color::Red,
false,
false,
false,
nullptr });
m_editor->document().spans().prepend(
GUI::TextDocumentSpan {
text_range,
Gfx::TextAttributes {
Color::Black,
Color::Red,
false,
false,
},
nullptr,
false });
}
m_editor->update();
}