diff --git a/src/model/chathistory.cpp b/src/model/chathistory.cpp index 76f476d1e..0b4585763 100644 --- a/src/model/chathistory.cpp +++ b/src/model/chathistory.cpp @@ -158,19 +158,13 @@ SearchResult ChatHistory::searchBackward(SearchPos startIdx, const QString& phra history->getDateWhereFindPhrase(f.getPublicKey().toString(), earliestMessageDate, phrase, parameter); - if (dateWherePhraseFound.isValid()) { - auto loadIdx = history->getNumMessagesForFriendBeforeDate(f.getPublicKey(), dateWherePhraseFound); - loadHistoryIntoSessionChatLog(ChatLogIdx(loadIdx)); + auto loadIdx = history->getNumMessagesForFriendBeforeDate(f.getPublicKey(), dateWherePhraseFound); + loadHistoryIntoSessionChatLog(ChatLogIdx(loadIdx)); - // Reset search pos to the message we just loaded to avoid a double search - startIdx.logIdx = ChatLogIdx(loadIdx); - startIdx.numMatches = 0; - return sessionChatLog.searchBackward(startIdx, phrase, parameter); - } - - SearchResult ret; - ret.found = false; - return ret; + // Reset search pos to the message we just loaded to avoid a double search + startIdx.logIdx = ChatLogIdx(loadIdx); + startIdx.numMatches = 0; + return sessionChatLog.searchBackward(startIdx, phrase, parameter); } ChatLogIdx ChatHistory::getFirstIdx() const diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index 1b2ccaeb6..dd224a961 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -986,13 +986,7 @@ void GenericChatForm::onSearchUp(const QString& phrase, const ParameterSearch& p void GenericChatForm::onSearchDown(const QString& phrase, const ParameterSearch& parameter) { - auto result = chatLog.searchForward(searchPos, phrase, parameter); - - if (result.found && result.pos.logIdx.get() > messages.end()->first.get()) { - const auto dt = chatLog.at(result.pos.logIdx).getTimestamp(); - loadHistory(dt, LoadHistoryDialog::from); - } - + auto result = chatLog.searchForward(searchPos, phrase, parameter); handleSearchResult(result, SearchDirection::Down); } @@ -1014,7 +1008,6 @@ void GenericChatForm::handleSearchResult(SearchResult result, SearchDirection di chatWidget->scrollToLine(msg); auto text = qobject_cast(msg->getContent(1)); - text->visibilityChanged(true); text->selectText(result.exp, std::make_pair(result.start, result.len)); }); }