From: Kevin McCarthy Date: Thu, 19 Jan 2017 22:58:13 +0000 (-0800) Subject: Fix sidebar references to the "new count" to be "unread". (closes #3908) X-Git-Tag: neomutt-20170225~33^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2586ec0cdc3d41f04b49fcc2cce4876c08910a69;p=neomutt Fix sidebar references to the "new count" to be "unread". (closes #3908) %N in $sidebar_format and "new"in $sidebar_sort_method actually use the unread message count. Update the documentation to mention that. Add an "unread" method to $sidebar_sort_method, but preserve "new" for compatibility. Change the SORT_COUNT_NEW constant to SORT_UNREAD, so the code is also consistent with the meaning. Thanks to cri for reporting the problem and suggesting where to fix it in the code. --- diff --git a/browser.c b/browser.c index 7e31f614d..1eb232408 100644 --- a/browser.c +++ b/browser.c @@ -197,7 +197,7 @@ static int browser_compare (const void *a, const void *b) return browser_compare_desc(a, b); case SORT_COUNT: return browser_compare_count(a, b); - case SORT_COUNT_NEW: + case SORT_UNREAD: return browser_compare_count_new(a, b); case SORT_SUBJECT: default: @@ -1751,7 +1751,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num break; case 6: /* ne(w) count */ - BrowserSort = SORT_COUNT_NEW; + BrowserSort = SORT_UNREAD; break; case 7: /* do(n)'t sort */ diff --git a/doc/manual.xml.head b/doc/manual.xml.head index d5aace162..c9d2c37ba 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -13409,12 +13409,16 @@ set sort_browser="reverse-size" new - Number of new messages + Number of unread messages path Alphabetically by path + + unread + Number of unread messages + unsorted Order of the mailboxes command diff --git a/init.h b/init.h index 0791d5186..9375adadb 100644 --- a/init.h +++ b/init.h @@ -3174,7 +3174,7 @@ struct option_t MuttVars[] = { ** .dl ** .dt %B .dd Name of the mailbox ** .dt %S .dd * Size of mailbox (total number of messages) - ** .dt %N .dd * Number of New messages in the mailbox + ** .dt %N .dd * Number of unread messages in the mailbox ** .dt %n .dd N if mailbox has new mail, blank otherwise ** .dt %F .dd * Number of Flagged messages in the mailbox ** .dt %! .dd ``!'' : one flagged message; @@ -3250,7 +3250,10 @@ struct option_t MuttVars[] = { ** .dd alpha (alphabetically) ** .dd count (all message count) ** .dd flagged (flagged message count) - ** .dd new (new message count) + ** .dd name (alphabetically) + ** .dd new (unread message count) + ** .dd path (alphabetically) + ** .dd unread (unread message count) ** .dd unsorted ** .ie ** .pp @@ -4347,7 +4350,7 @@ const struct mapping_t SortBrowserMethods[] = { { "count", SORT_COUNT }, { "date", SORT_DATE }, { "desc", SORT_DESC }, - { "new", SORT_COUNT_NEW }, + { "new", SORT_UNREAD }, { "size", SORT_SIZE }, { "unsorted", SORT_ORDER }, { NULL, 0 } @@ -4375,8 +4378,9 @@ const struct mapping_t SortSidebarMethods[] = { { "flagged", SORT_FLAGGED }, { "mailbox-order", SORT_ORDER }, { "name", SORT_PATH }, - { "new", SORT_COUNT_NEW }, + { "new", SORT_UNREAD }, /* kept for compatibility */ { "path", SORT_PATH }, + { "unread", SORT_UNREAD }, { "unsorted", SORT_ORDER }, { NULL, 0 } }; diff --git a/sidebar.c b/sidebar.c index 9c7bd852b..022dc597a 100644 --- a/sidebar.c +++ b/sidebar.c @@ -310,7 +310,7 @@ static int cb_qsort_sbe (const void *a, const void *b) case SORT_COUNT: result = (b2->msg_count - b1->msg_count); break; - case SORT_COUNT_NEW: + case SORT_UNREAD: result = (b2->msg_unread - b1->msg_unread); break; case SORT_DESC: @@ -421,7 +421,7 @@ static void sort_entries (void) /* These are the only sort methods we understand */ if ((ssm == SORT_COUNT) || - (ssm == SORT_COUNT_NEW) || + (ssm == SORT_UNREAD) || (ssm == SORT_FLAGGED) || (ssm == SORT_PATH)) qsort (Entries, EntryCount, sizeof (*Entries), cb_qsort_sbe); diff --git a/sort.h b/sort.h index 4242e9dce..b2c35cfd4 100644 --- a/sort.h +++ b/sort.h @@ -32,11 +32,11 @@ #define SORT_TRUST 13 #define SORT_SPAM 14 #define SORT_COUNT 15 -#define SORT_COUNT_NEW 16 +#define SORT_UNREAD 16 #define SORT_FLAGGED 17 #define SORT_PATH 18 -#define SORT_DESC 19 -#define SORT_LABEL 20 +#define SORT_LABEL 19 +#define SORT_DESC 20 /* Sort and sort_aux are shorts, and are a composite of a * constant sort operation number and a set of compounded