diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 927cf294af3..a1e8dfa8f03 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -3680,7 +3680,7 @@ void TextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block, co .toTextCharFormat(C_SEARCH_RESULT).background().color().darker(120); while (idx < text.length()) { - const QRegularExpressionMatch match = m_searchExpr.match(text, idx + 1); + const QRegularExpressionMatch match = m_searchExpr.match(text, idx + l + 1); if (!match.hasMatch()) break; idx = match.capturedStart();