]> granicus.if.org Git - neomutt/commitdiff
Only sort the sidebar if we're asked to
authorRichard Russon <rich@flatcap.org>
Thu, 7 Apr 2016 13:06:27 +0000 (14:06 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 7 Apr 2016 19:58:27 +0000 (20:58 +0100)
fixes #11

init.h
sidebar.c

diff --git a/init.h b/init.h
index 7dc97675a97317dc48aba28f8c8e640cc9866554..f088e55af6d11086c591068bd28d3ad2028543b2 100644 (file)
--- a/init.h
+++ b/init.h
@@ -3796,14 +3796,16 @@ const struct mapping_t SortKeyMethods[] = {
 };
 
 const struct mapping_t SortSidebarMethods[] = {
-  { "count",   SORT_COUNT },
-  { "flagged", SORT_FLAGGED },
-  { "new",     SORT_COUNT_NEW },
-  { "path",    SORT_PATH },
-  { "alpha",   SORT_PATH },
-  { "name",    SORT_PATH },
-  { "unsorted",        SORT_ORDER },
-  { NULL,       0 }
+  { "alpha",           SORT_PATH },
+  { "count",           SORT_COUNT },
+  { "desc",            SORT_DESC },
+  { "flagged",         SORT_FLAGGED },
+  { "mailbox-order",   SORT_ORDER },
+  { "name",            SORT_PATH },
+  { "new",             SORT_COUNT_NEW },
+  { "path",            SORT_PATH },
+  { "unsorted",                SORT_ORDER },
+  { NULL,              0 }
 };
 
 
index 5a9cfcbf99e6c4e4ca1f7563d5d848ef32a1f032..557198c6399fe9bf1dc52ff07934ce19982073b7 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -441,7 +441,15 @@ sort_buffy_array (BUFFY **arr, int arr_len)
        if (!arr)
                return;
 
-       qsort (arr, arr_len, sizeof (*arr), cb_qsort_buffy);
+       /* These are the only sort methods we understand */
+       short ssm = (SidebarSortMethod & SORT_MASK);
+       if ((ssm == SORT_COUNT)     ||
+           (ssm == SORT_COUNT_NEW) ||
+           (ssm == SORT_DESC)      ||
+           (ssm == SORT_FLAGGED)   ||
+           (ssm == SORT_PATH)) {
+               qsort (arr, arr_len, sizeof (*arr), cb_qsort_buffy);
+       }
 
        int i;
        for (i = 0; i < (arr_len - 1); i++) {