Skip to content

Commit

Permalink
opt: fulltext next navigation optimization (#1718)
Browse files Browse the repository at this point in the history
* opt: fulltext dialog navigation optimization.

The fulltext dialog navigation (next,previous) use webview's findText,try to find the longest word for navigation
  • Loading branch information
xiaoyifang authored Aug 9, 2024
1 parent b0bea92 commit 3279fe8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/ui/articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2111,10 +2111,18 @@ void ArticleView::highlightFTSResults()

webview->page()->runJavaScript( script );
auto parts = regString.split( " ", Qt::SkipEmptyParts );
if ( !parts.isEmpty() ) {
firstAvailableText = parts[ 0 ];
ftsSearchPanel->show();
if ( parts.isEmpty() ) {
return;
}

//hold the longest word
for ( auto & p : parts ) {
if ( p.size() > firstAvailableText.size() ) {
firstAvailableText = p;
}
}

ftsSearchPanel->show();
}

void ArticleView::setActiveDictIds( const ActiveDictIds & ad )
Expand Down

0 comments on commit 3279fe8

Please sign in to comment.