From b8f49ec3dcf03a3d6476e8cf5f0852c0fa9e8b5b Mon Sep 17 00:00:00 2001 From: Xiao Yi Fang Date: Tue, 6 Aug 2024 10:34:02 +0800 Subject: [PATCH 1/3] opt:mark.js only highlight exact words --- src/ui/articleview.cc | 2 +- src/ui/mainwindow.cc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) 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..c056a443 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -2751,7 +2751,6 @@ void MainWindow::toggleMainWindow( bool onlyShow ) if ( !cfg.preferences.searchInDock ) translateBox->setPopupEnabled( false ); - qDebug() << "Current state:" << isVisible() << isMinimized() << isActiveWindow() << onlyShow; if ( !isVisible() ) { show(); From ec63fa550d86d495c948a7afb6c43524c488c7bd Mon Sep 17 00:00:00 2001 From: Xiao Yi Fang Date: Thu, 8 Aug 2024 11:42:22 +0800 Subject: [PATCH 2/3] fix: popup dialog , switch groups should use articleview's word --- src/ui/scanpopup.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); From b0bea921063184bfa5e5e1271b6b522e5753c705 Mon Sep 17 00:00:00 2001 From: xiaoyifang <105986+xiaoyifang@users.noreply.github.com> Date: Fri, 9 Aug 2024 09:37:57 +0800 Subject: [PATCH 3/3] opt: remove outdated fulltext temp index (#1717) * opt: remove outdated fulltext temp index * opt: remove outdated fulltext temp index --- src/ui/mainwindow.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index c056a443..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(); } }