From: Thomas Roessler Date: Sat, 22 Apr 2000 09:27:07 +0000 (+0000) Subject: Handle sort_aux="threads" somewhat different, and probably more X-Git-Tag: mutt-1-1-12-rel~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3d518406adabfb0bedbf7fb387726251172fe95;p=mutt Handle sort_aux="threads" somewhat different, and probably more safely. Problem and principle of fix noted by Gero Treuner and Michael Tatge . --- diff --git a/init.c b/init.c index 68429cbf..be4e3458 100644 --- a/init.c +++ b/init.c @@ -1127,6 +1127,9 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) map = SortKeyMethods; break; #endif + case DT_SORT_AUX: + map = SortAuxMethods; + break; default: map = SortMethods; break; diff --git a/init.h b/init.h index d1880c43..02022ff8 100644 --- a/init.h +++ b/init.h @@ -44,6 +44,7 @@ #define DT_SORT_ALIAS 0x10 #define DT_SORT_BROWSER 0x20 #define DT_SORT_KEYS 0x40 +#define DT_SORT_AUX 0x80 /* flags to parse_set() */ #define M_SET_INV (1<<0) /* default is to invert all vars */ @@ -1823,7 +1824,7 @@ struct option_t MuttVars[] = { ** . unsorted (leave in order specified in .muttrc) ** .te */ - { "sort_aux", DT_SORT, R_INDEX|R_RESORT_BOTH, UL &SortAux, SORT_DATE }, + { "sort_aux", DT_SORT|DT_SORT_AUX, R_INDEX|R_RESORT_BOTH, UL &SortAux, SORT_DATE }, /* ** .pp ** When sorting by threads, this variable controls how threads are sorted @@ -2120,6 +2121,25 @@ const struct mapping_t SortMethods[] = { { NULL, 0 } }; +/* same as SortMethods, but with "threads" replaced by "date" */ + +const struct mapping_t SortAuxMethods[] = { + { "date", SORT_DATE }, + { "date-sent", SORT_DATE }, + { "date-received", SORT_RECEIVED }, + { "mailbox-order", SORT_ORDER }, + { "subject", SORT_SUBJECT }, + { "from", SORT_FROM }, + { "size", SORT_SIZE }, + { "threads", SORT_DATE }, /* note: sort_aux == threads + * isn't possible. + */ + { "to", SORT_TO }, + { "score", SORT_SCORE }, + { NULL, 0 } +}; + + const struct mapping_t SortBrowserMethods[] = { { "alpha", SORT_SUBJECT }, { "date", SORT_DATE }, diff --git a/thread.c b/thread.c index 3c12c28d..34af7446 100644 --- a/thread.c +++ b/thread.c @@ -537,12 +537,6 @@ void mutt_sort_threads (CONTEXT *ctx, int init) oldsort = Sort; Sort = SortAux; - /* get secondary sorting method. we can't have threads, so use the date - * if the user specified it - */ - if ((Sort & SORT_MASK) == SORT_THREADS) - Sort = (Sort & ~SORT_MASK) | SORT_DATE; - /* if the SORT_LAST bit is set, we save sorting for later */ if (!(Sort & SORT_LAST)) usefunc = mutt_get_sort_func (Sort);