diff options
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 8b8105615c..83501dc79e 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -531,6 +531,10 @@ void TextEditor::paint_event(PaintEvent& event) break; } auto& span = document().spans()[span_index]; + if (!span.range.is_valid()) { + ++span_index; + continue; + } if (span.range.end().line() < line_index) { dbgln("spans not sorted (span end {}:{} is before current line {}) => ignoring", span.range.end().line(), span.range.end().column(), line_index); ++span_index; @@ -562,6 +566,11 @@ void TextEditor::paint_event(PaintEvent& event) } else { span_start = span.range.start().column() - start_of_visual_line; } + if (span_start < next_column) { + dbgln("span started before the current position, maybe two spans overlap? (span start {} is before current position {}) => ignoring", span_start, next_column); + ++span_index; + continue; + } size_t span_end; bool span_consumned; if (span.range.end().line() > line_index || span.range.end().column() >= start_of_visual_line + visual_line_text.length()) { |