diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index addadf7aaabbc1addf338c2b084167da47b084f0..cf01da50c191a8aa98761d187aa144833eab951b 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -223,7 +223,7 @@ BaseTextEditor::BaseTextEditor(QWidget *parent)
     d->m_searchResultFormat.setBackground(QColor(0xffef0b));
 
     slotUpdateExtraAreaWidth();
-    slotCursorPositionChanged();
+    updateHighlights();
     setFrameStyle(QFrame::NoFrame);
 
     d->m_delayedUpdateTimer = new QTimer(this);
@@ -3198,7 +3198,11 @@ void BaseTextEditor::slotCursorPositionChanged()
     } else if (d->m_contentsChanged) {
         saveCurrentCursorPositionForNavigation();
     }
+    updateHighlights();
+}
 
+void BaseTextEditor::updateHighlights()
+{
     if (d->m_parenthesesMatchingEnabled && hasFocus()) {
         // Delay update when no matching is displayed yet, to avoid flicker
         if (extraSelections(ParenthesesMatchingSelection).isEmpty()
@@ -4774,7 +4778,7 @@ void BaseTextEditor::changeEvent(QEvent *e)
 void BaseTextEditor::focusInEvent(QFocusEvent *e)
 {
     QPlainTextEdit::focusInEvent(e);
-    slotCursorPositionChanged();
+    updateHighlights();
 }
 
 void BaseTextEditor::focusOutEvent(QFocusEvent *e)
@@ -5157,7 +5161,7 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds)
         d->m_highlightBlocksInfo = BaseTextEditorPrivateHighlightBlocks();
     }
 
-    slotCursorPositionChanged();
+    updateHighlights();
     viewport()->update();
     extraArea()->update();
 }
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 0d8a79c24e956273808bf3bc01c57275b0f47d09..ba4e9f1003b5263c8dc033c5fdf1c8fc428e560f 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -626,6 +626,7 @@ private:
     void moveLineUpDown(bool up);
     void copyLineUpDown(bool up);
     void saveCurrentCursorPositionForNavigation();
+    void updateHighlights();
     void updateCurrentLineHighlight();
 
     void drawFoldingMarker(QPainter *painter, const QPalette &pal,