diff options
author | David Schulz <david.schulz@qt.io> | 2020-02-26 08:07:28 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2020-02-26 08:09:54 +0000 |
commit | af52b65d6a6b4fe50deb074474c55817c669556f (patch) | |
tree | e615ffe3a08871ab3ac6b6092a0e524228b8c06f | |
parent | 8625bbfe5a7cd9de4139a5d80f3479386c8594bd (diff) | |
download | qt-creator-af52b65d6a6b4fe50deb074474c55817c669556f.tar.gz |
Editor: Fix self recursive update
The update rect should be identical to the calculated line rect when
repainting the current line highlight. And the offset must not be
calculated into the line rect since we just want to repaint the complete
viewport width.
Fixes: QTCREATORBUG-23647
Change-Id: I0656f0fee4823c8ff55c70b2a4cd69f0183e141d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/plugins/texteditor/texteditor.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index a48d58d126..43e125e2fc 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4334,16 +4334,12 @@ void TextEditorWidgetPrivate::paintCurrentLineHighlight(const PaintEventData &da QRectF lineRect = data.block.layout()->lineForTextPosition(data.textCursor.positionInBlock()).rect(); lineRect.moveTop(lineRect.top() + blockRect.top()); lineRect.setLeft(0); - lineRect.setRight(data.viewportRect.width() - data.offset.x()); + lineRect.setRight(data.viewportRect.width()); QColor color = m_document->fontSettings().toTextCharFormat(C_CURRENT_LINE).background().color(); // set alpha, otherwise we cannot see block highlighting and find scope underneath color.setAlpha(128); - if (!data.eventRect.contains(lineRect.toRect())) { - QRect updateRect = data.eventRect; - updateRect.setLeft(0); - updateRect.setRight(data.viewportRect.width() - int(data.offset.x())); - q->viewport()->update(updateRect); - } + if (!data.eventRect.contains(lineRect.toRect())) + q->viewport()->update(lineRect.toRect()); painter.fillRect(lineRect, color); } |