From 6a3b0edba872d3bfb24f81ad758a8b68708f20a6 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 8 Oct 2021 11:54:03 +0200 Subject: [PATCH] fix #507 for good - note that there was some very common code changed, feared of regressions, hopefully, they will not be there --- src/librssguard/gui/messagesview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librssguard/gui/messagesview.cpp b/src/librssguard/gui/messagesview.cpp index 84c31bd92..7874b6c4a 100644 --- a/src/librssguard/gui/messagesview.cpp +++ b/src/librssguard/gui/messagesview.cpp @@ -147,6 +147,9 @@ void MessagesView::keyboardSearch(const QString& search) { void MessagesView::reloadSelections() { const QDateTime dt1 = QDateTime::currentDateTime(); QModelIndex current_index = selectionModel()->currentIndex(); + const bool is_current_selected = selectionModel()->selectedRows().contains(m_proxyModel->index(current_index.row(), + 0, + current_index.parent())); const QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index); const Message selected_message = m_sourceModel->messageAt(mapped_current_index.row()); const int col = header()->sortIndicatorSection(); @@ -157,7 +160,8 @@ void MessagesView::reloadSelections() { // Now, we must find the same previously focused message. if (selected_message.m_id > 0) { - if (m_proxyModel->rowCount() == 0) { + if (m_proxyModel->rowCount() == 0 || + !is_current_selected) { current_index = QModelIndex(); } else {