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 <eike.ziller@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-06-07 07:56:32 +02:00
parent 4c5f9dcbd4
commit b82f321c9a

View File

@@ -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;