Skip to content

Commit

Permalink
opt: findtext casesensitivity (#1698)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
xiaoyifang and autofix-ci[bot] authored Jul 18, 2024
1 parent 5164ffb commit 06d4b62
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/ui/articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
}

Expand Down Expand Up @@ -2065,10 +2070,7 @@ bool ArticleView::closeSearch()
ftsSearchPanel->hide();
webview->setFocus();

QWebEnginePage::FindFlags flags( 0 );

webview->findText( "", flags );

webview->findText( "" );
return true;
}
return false;
Expand Down

0 comments on commit 06d4b62

Please sign in to comment.