diff --git a/src/fulltextsearch.cc b/src/fulltextsearch.cc index 0695f125..dae3ddd0 100644 --- a/src/fulltextsearch.cc +++ b/src/fulltextsearch.cc @@ -453,26 +453,8 @@ void FullTextSearchDialog::itemClicked( const QModelIndex & idx ) auto searchText = ui.searchLine->text(); searchText.replace( RX::Ftx::tokenBoundary, " " ); - auto it = RX::Ftx::token.globalMatch( searchText ); - QString firstAvailbeItem; - while ( it.hasNext() ) { - QRegularExpressionMatch match = it.next(); - - auto p = match.captured(); - if ( p.startsWith( '-' ) ) - continue; - - //the searched text should be like "term".remove enclosed double quotation marks. - if ( p.startsWith( "\"" ) ) { - p.remove( "\"" ); - } - - firstAvailbeItem = p; - break; - } - - if ( !firstAvailbeItem.isEmpty() ) { - reg = QRegularExpression( firstAvailbeItem, QRegularExpression::CaseInsensitiveOption ); + if ( !searchText.isEmpty() ) { + reg = QRegularExpression( searchText, QRegularExpression::CaseInsensitiveOption ); } emit showTranslationFor( headword, results[ idx.row() ].dictIDs, reg, false ); diff --git a/src/ui/articleview.cc b/src/ui/articleview.cc index 1b58aac4..6375ff44 100644 --- a/src/ui/articleview.cc +++ b/src/ui/articleview.cc @@ -2125,8 +2125,8 @@ void ArticleView::highlightFTSResults() QString script = QString( "var context = document.querySelector(\"body\");\n" - "var instance = new Mark(context);\n" - "instance.mark(\"%1\",{\"accuracy\": \"exactly\"});" ) + "var instance = new Mark(context);\n instance.unmark();\n" + "instance.mark(\"%1\");" ) .arg( regString ); webview->page()->runJavaScript( script );