diff --git a/src/ui/articleview.cc b/src/ui/articleview.cc index d66ab839..08faee3f 100644 --- a/src/ui/articleview.cc +++ b/src/ui/articleview.cc @@ -2106,7 +2106,7 @@ void ArticleView::highlightFTSResults() QString script = QString( "var context = document.querySelector(\"body\");\n" "var instance = new Mark(context);\n instance.unmark();\n" - "instance.mark(\"%1\");" ) + "instance.mark(\"%1\",{\"accuracy\": \"exactly\"});" ) .arg( regString ); webview->page()->runJavaScript( script ); diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index e240d00c..355e6d25 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -1216,6 +1216,32 @@ void MainWindow::commitData() if ( d.exists() ) { d.removeRecursively(); } + //temp dir + QDir dtemp( filePath + "_FTS_x_temp" ); + if ( dtemp.exists() ) { + dtemp.removeRecursively(); + } + } + + + //remove temp directories. + QFileInfoList const dirs = dir.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot ); + + for ( auto & file : dirs ) { + QString const fileName = file.fileName(); + + if ( !fileName.endsWith( "_temp" ) ) + continue; + + const QFileInfo info( fileName ); + const QDateTime lastModified = info.lastModified(); + + //if the temp directory has not been modified within 7 days,remove the temp directory. + if ( lastModified.addDays( 7 ) > QDateTime::currentDateTime() ) { + continue; + } + QDir d( fileName ); + d.removeRecursively(); } } @@ -2751,7 +2777,6 @@ void MainWindow::toggleMainWindow( bool onlyShow ) if ( !cfg.preferences.searchInDock ) translateBox->setPopupEnabled( false ); - qDebug() << "Current state:" << isVisible() << isMinimized() << isActiveWindow() << onlyShow; if ( !isVisible() ) { show(); diff --git a/src/ui/scanpopup.cc b/src/ui/scanpopup.cc index 01e49e11..cb428f3f 100644 --- a/src/ui/scanpopup.cc +++ b/src/ui/scanpopup.cc @@ -593,7 +593,8 @@ void ScanPopup::currentGroupChanged( int ) if ( isVisible() ) { updateSuggestionList(); - translateInputFinished(); + QString word = Folding::unescapeWildcardSymbols( definition->getWord() ); + showTranslationFor( word ); } cfg.lastPopupGroupId = ui.groupList->getCurrentGroup();