diff --git a/article_maker.cc b/article_maker.cc index b27c53fd..d93273f6 100644 --- a/article_maker.cc +++ b/article_maker.cc @@ -429,9 +429,10 @@ ArticleRequest::ArticleRequest( data.resize( header.size() ); memcpy( &data.front(), header.data(), header.size() ); - // Accumulate main forms + //clear founded dicts. emit GlobalBroadcaster::instance()->dictionaryClear( ActiveDictIds{word} ); + // Accumulate main forms for( unsigned x = 0; x < activeDicts.size(); ++x ) { sptr< Dictionary::WordSearchRequest > s = activeDicts[ x ]->findHeadwordsForSynonym( gd::toWString( word ) ); diff --git a/articleview.cc b/articleview.cc index 4766d413..b1f4cd53 100644 --- a/articleview.cc +++ b/articleview.cc @@ -401,6 +401,7 @@ void ArticleView::showDefinition( Config::InputPhrase const & phrase, unsigned g Contexts const & contexts_ ) { currentWord = phrase.phrase.trimmed(); + historyMode = false; currentActiveDictIds.clear(); // first, let's stop the player audioPlayer->stop(); @@ -484,6 +485,7 @@ void ArticleView::showDefinition( QString const & word, QStringList const & dict if( dictIDs.isEmpty() ) return; currentWord = word.trimmed(); + historyMode = false; // first, let's stop the player audioPlayer->stop(); @@ -1623,6 +1625,8 @@ void ArticleView::back() if ( canGoBack() ) { saveHistoryUserData(); + currentActiveDictIds.clear(); + historyMode = true; ui.definition->back(); } } @@ -1630,6 +1634,8 @@ void ArticleView::back() void ArticleView::forward() { saveHistoryUserData(); + currentActiveDictIds.clear(); + historyMode = true; ui.definition->forward(); } @@ -2619,7 +2625,7 @@ void ArticleView::highlightAllFtsOccurences( QWebEnginePage::FindFlags flags ) } void ArticleView::setActiveDictIds(ActiveDictIds ad) { - if (ad.word == currentWord) { + if (ad.word == currentWord || historyMode) { // ignore all other signals. qDebug() << "receive dicts, current word:" << currentWord << ad.word << ":" << ad.dictIds; currentActiveDictIds << ad.dictIds; @@ -2712,10 +2718,6 @@ void ArticleView::performFtsFindOperation( bool backwards ) #endif ui.ftsSearchStatusLabel->setText( searchStatusMessage( ftsPosition + 1, allMatches.size() ) ); - // Store new highlighted selection - // ui.definition->page()-> - // runJavaScript( QString( "%1=window.getSelection().getRangeAt(0);_=0;" ) - // .arg( rangeVarName ) ); } void ArticleView::on_ftsSearchPrevious_clicked() diff --git a/articleview.hh b/articleview.hh index c4131053..32f5b9b3 100644 --- a/articleview.hh +++ b/articleview.hh @@ -70,6 +70,8 @@ class ArticleView: public QFrame /// current active dict id list; QStringList currentActiveDictIds; + bool historyMode=false; + //current active dictionary id; QString activeDictId;