opt: findtext casesensitivity (#1698)

* opt: reset the selection results

* opt: remove the existed highlight when no match

* [autofix.ci] apply automated fixes

* opt: remove the existed highlight when no match

* opt: remove the existed highlight when no match

* opt: code minor optimization

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
xiaoyifang 2024-07-18 13:33:49 +08:00 committed by GitHub
parent 5164ffba67
commit 06d4b62b67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2026,8 +2026,13 @@ void ArticleView::performFindOperation( bool backwards )
f |= QWebEnginePage::FindBackward;
findText( text, f, [ text, this ]( bool match ) {
bool setMark = !text.isEmpty() && !match;
Utils::Widget::setNoResultColor( searchPanel->lineEdit, setMark );
bool nomatch = !text.isEmpty() && !match;
if ( nomatch ) {
//clear the previous findText results.
//when the results is empty, the highlight has not been removed.more likely a qt bug.
webview->findText( "" );
}
Utils::Widget::setNoResultColor( searchPanel->lineEdit, nomatch );
} );
}
@ -2065,10 +2070,7 @@ bool ArticleView::closeSearch()
ftsSearchPanel->hide();
webview->setFocus();
QWebEnginePage::FindFlags flags( 0 );
webview->findText( "", flags );
webview->findText( "" );
return true;
}
return false;