mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: fulltext next navigation optimization (#1718)
* opt: fulltext dialog navigation optimization. The fulltext dialog navigation (next,previous) use webview's findText,try to find the longest word for navigation
This commit is contained in:
parent
b0bea92106
commit
3279fe8b07
|
@ -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 )
|
||||
|
|
Loading…
Reference in a new issue