1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 19:45:08 +00:00

LibGUI: Make GTextEditor::Span have a range instead of two positions

A GTextRange is really just two GTextPositions (start and end) anyway.
This way we can say nice things like "if (range.contains(position))"
This commit is contained in:
Andreas Kling 2019-10-26 15:32:12 +02:00
parent 4fa8acf6ea
commit bc2026d26d
3 changed files with 14 additions and 16 deletions

View file

@ -256,8 +256,8 @@ static void rehighlight()
dbg() << token.to_string() << " @ " << token.m_start.line << ":" << token.m_start.column << " - " << token.m_end.line << ":" << token.m_end.column;
#endif
GTextEditor::Span span;
span.start = { token.m_start.line, token.m_start.column };
span.end = { token.m_end.line, token.m_end.column };
span.range.set_start({ token.m_start.line, token.m_start.column });
span.range.set_end({ token.m_end.line, token.m_end.column });
auto style = style_for_token_type(token.m_type);
span.color = style.color;
span.font = style.font;