diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 8471ec947b989b77f2cb37590fa3ebbb2084a55e..db0fb8073514c27924e119a4556d18beef7969ce 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -1479,7 +1479,8 @@ BaseTextEditorPrivate::BaseTextEditorPrivate() m_inBlockSelectionMode(false), m_lastEventWasBlockSelectionEvent(false), m_blockSelectionExtraX(0), - m_moveLineUndoHack(false) + m_moveLineUndoHack(false), + m_cursorBlockNumber(-1) { } @@ -2781,6 +2782,22 @@ void BaseTextEditor::updateCurrentLineHighlight() } setExtraSelections(CurrentLineSelection, extraSelections); + + + // the extra area shows information for the entire current block, not just the currentline. + // This is why we must force a bigger update region. + int cursorBlockNumber = textCursor().blockNumber(); + if (cursorBlockNumber != d->m_cursorBlockNumber) { + QPointF offset = contentOffset(); + QTextBlock block = document()->findBlockByNumber(d->m_cursorBlockNumber); + if (block.isValid()) + d->m_extraArea->update(blockBoundingGeometry(block).translated(offset).toAlignedRect()); + block = document()->findBlockByNumber(cursorBlockNumber); + if (block.isValid()) + d->m_extraArea->update(blockBoundingGeometry(block).translated(offset).toAlignedRect()); + d->m_cursorBlockNumber = cursorBlockNumber; + } + } void BaseTextEditor::slotCursorPositionChanged() diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index a1829e70f8179999cafb2199ea4dd3499c8c1120..70fa38c759f97eca867816c94ea42018a1612586 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -243,6 +243,7 @@ public: QTimer *m_highlightBlocksTimer; QPointer<BaseTextEditorAnimator> m_animator; + int m_cursorBlockNumber; };