From 0c92a010d3c726bd289c4d9fbb038ef43dfd6624 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 24 Sep 2019 12:56:00 +0100 Subject: [PATCH 1/1] respect 'default selection' settings when moving a msg with manual filtering --- src/summaryview.c | 79 ++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 45 deletions(-) diff --git a/src/summaryview.c b/src/summaryview.c index 96016b9d0..88c2c39c9 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -1511,52 +1511,43 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item) g_slist_free(mlist); - if (is_refresh) { - if (!quicksearch_is_in_typing(summaryview->quicksearch)) { - summaryview->displayed = - summary_find_msg_by_msgnum(summaryview, - displayed_msgnum); - if (!summaryview->displayed) - messageview_clear(summaryview->messageview); + if (quicksearch_is_in_typing(summaryview->quicksearch) || + quicksearch_is_running(summaryview->quicksearch)) { + summaryview->displayed = + summary_find_msg_by_msgnum(summaryview, + displayed_msgnum); + if (!summaryview->displayed) + messageview_clear(summaryview->messageview); + summary_unlock(summaryview); + + if (quicksearch_is_running(summaryview->quicksearch)) + summary_select_by_msgnum(summaryview, selected_msgnum, + OPEN_SELECTED_ON_SEARCH_RESULTS); + else + summary_select_by_msgnum(summaryview, selected_msgnum, + FALSE); + + summary_lock(summaryview); + if (!summaryview->selected) { + /* no selected message - select first unread + message, but do not display it */ + node = summary_find_next_flagged_msg(summaryview, NULL, + MSG_UNREAD, FALSE); + if (node == NULL && GTK_CMCLIST(ctree)->row_list != NULL) + node = gtk_cmctree_node_nth + (ctree, + item->sort_type == SORT_DESCENDING + ? 0 : GTK_CMCLIST(ctree)->rows - 1); summary_unlock(summaryview); if (quicksearch_is_running(summaryview->quicksearch)) - summary_select_by_msgnum(summaryview, selected_msgnum, + summary_select_node(summaryview, node, OPEN_SELECTED_ON_SEARCH_RESULTS); else - summary_select_by_msgnum(summaryview, selected_msgnum, - FALSE); + summary_select_node(summaryview, node, + OPEN_SELECTED_ON_FOLDER_OPEN); summary_lock(summaryview); - if (!summaryview->selected) { - /* no selected message - select first unread - message, but do not display it */ - node = summary_find_next_flagged_msg(summaryview, NULL, - MSG_UNREAD, FALSE); - if (node == NULL && GTK_CMCLIST(ctree)->row_list != NULL) - node = gtk_cmctree_node_nth - (ctree, - item->sort_type == SORT_DESCENDING - ? 0 : GTK_CMCLIST(ctree)->rows - 1); - summary_unlock(summaryview); - - if (quicksearch_is_running(summaryview->quicksearch)) - summary_select_node(summaryview, node, - OPEN_SELECTED_ON_SEARCH_RESULTS); - else - summary_select_node(summaryview, node, - OPEN_SELECTED_ON_FOLDER_OPEN); - - summary_lock(summaryview); - } - } else { - /* just select first/last */ - if (GTK_CMCLIST(ctree)->row_list != NULL) - node = gtk_cmctree_node_nth - (ctree, - item->sort_type == SORT_DESCENDING - ? 0 : GTK_CMCLIST(ctree)->rows - 1); - summary_select_node(summaryview, node, OPEN_SELECTED_ON_SEARCH_RESULTS); } } else { /* backward compat */ @@ -1662,12 +1653,10 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item) if (node) { gint open_selected = -1; - if (!is_refresh) { - if (OPEN_SELECTED_ON_FOLDER_OPEN) - open_selected = 1; - else - open_selected = 0; - } + if (OPEN_SELECTED_ON_FOLDER_OPEN) + open_selected = 1; + else + open_selected = 0; summary_select_node(summaryview, node, open_selected); } -- 2.25.1