Editor: Fix painting overlay selection

The border around the selection overlaps the line rect, so in order to
correctly repaint the selection when scrolling we need to widen the
prefiltering of painted selection.

Change-Id: I953749571e3e9ae412bf05f47ab3c4c3bfb8861e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-07-05 08:51:36 +02:00
parent c732667838
commit 1dbeb17841

View File

@@ -340,8 +340,8 @@ void TextEditorOverlay::paint(QPainter *painter, const QRect &clip)
: m_editor->blockCount() - 1;
auto overlapsClip = [&](const OverlaySelection &selection) {
return selection.m_cursor_end.blockNumber() >= firstBlockNumber
&& selection.m_cursor_begin.blockNumber() <= lastBlockNumber;
return selection.m_cursor_end.blockNumber() + 1 >= firstBlockNumber
&& selection.m_cursor_begin.blockNumber() - 1 <= lastBlockNumber;
};
for (int i = m_selections.size() - 1; i >= 0; --i) {