From b82f321c9aa750407b00cb492771bdc0c4e78561 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 7 Jun 2022 07:56:32 +0200 Subject: [PATCH] texteditor: Add Select Next Match respect find settings To increase the usefullness of the function, this change adds the current search settings to the find() call. This way the "case sensitive" and "whole words only" is taken into account when searching for the next occurrence of the selected text. Change-Id: Ia4b28e84c39b9298d2dcbfa381ccf19d8137bfc6 Reviewed-by: Eike Ziller --- src/plugins/texteditor/texteditor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 8d0441f47dd..f2d8fd81a47 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -6781,9 +6781,11 @@ void TextEditorWidgetPrivate::addSelectionNextFindMatch() return; } + const QTextDocument::FindFlags findFlags = textDocumentFlagsForFindFlags(m_findFlags); + int searchFrom = cursors.last().selectionEnd(); while (true) { - QTextCursor next = document->find(selection.toPlainText(), searchFrom); + QTextCursor next = document->find(selection.toPlainText(), searchFrom, findFlags); if (next.isNull()) { searchFrom = 0; continue;