diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-26 15:32:12 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-26 15:33:19 +0200 |
commit | bc2026d26d9789c5528e03dd00658b14cd56eaea (patch) | |
tree | e3f83a1bbb0e0a32db5abb5d4dbcd5bd5c5031e4 /Libraries/LibGUI/GTextEditor.cpp | |
parent | 4fa8acf6eae67583b36a9025a27c7ebd0c8cec43 (diff) | |
download | serenity-bc2026d26d9789c5528e03dd00658b14cd56eaea.zip |
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))"
Diffstat (limited to 'Libraries/LibGUI/GTextEditor.cpp')
-rw-r--r-- | Libraries/LibGUI/GTextEditor.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Libraries/LibGUI/GTextEditor.cpp b/Libraries/LibGUI/GTextEditor.cpp index f4caf54fe7..df373af563 100644 --- a/Libraries/LibGUI/GTextEditor.cpp +++ b/Libraries/LibGUI/GTextEditor.cpp @@ -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) |