mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24: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 );
|
webview->page()->runJavaScript( script );
|
||||||
auto parts = regString.split( " ", Qt::SkipEmptyParts );
|
auto parts = regString.split( " ", Qt::SkipEmptyParts );
|
||||||
if ( !parts.isEmpty() ) {
|
if ( parts.isEmpty() ) {
|
||||||
firstAvailableText = parts[ 0 ];
|
return;
|
||||||
ftsSearchPanel->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//hold the longest word
|
||||||
|
for ( auto & p : parts ) {
|
||||||
|
if ( p.size() > firstAvailableText.size() ) {
|
||||||
|
firstAvailableText = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ftsSearchPanel->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleView::setActiveDictIds( const ActiveDictIds & ad )
|
void ArticleView::setActiveDictIds( const ActiveDictIds & ad )
|
||||||
|
|
Loading…
Reference in a new issue