mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 07:04:58 +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:
parent
4fa8acf6ea
commit
bc2026d26d
3 changed files with 14 additions and 16 deletions
|
@ -373,11 +373,10 @@ void GTextEditor::paint_event(GPaintEvent& event)
|
|||
for (int i = 0; i < visual_line_text.length(); ++i) {
|
||||
const Font* font = &this->font();
|
||||
Color color;
|
||||
int physical_line = line_index;
|
||||
int physical_column = start_of_visual_line + i;
|
||||
GTextPosition physical_position(line_index, start_of_visual_line + i);
|
||||
// FIXME: This is *horribly* inefficient.
|
||||
for (auto& span : m_spans) {
|
||||
if (!span.contains(GTextPosition(physical_line, physical_column)))
|
||||
if (!span.range.contains(physical_position))
|
||||
continue;
|
||||
color = span.color;
|
||||
if (span.font)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue