From fc9ab1c98258e3e3a778608bdb122e64bca85115 Mon Sep 17 00:00:00 2001 From: David Champion Date: Tue, 13 Dec 2016 12:19:05 -0800 Subject: [PATCH] Add option to control whether threads uncollapse when new mail arrives. Adds $uncollapse_new: when set, the default, a collapsed thread into which a new message arrives will be uncollapsed to reveal the new message. --- curs_main.c | 4 ++-- init.h | 8 ++++++++ mutt.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/curs_main.c b/curs_main.c index 72dd885f2..5c35d8453 100644 --- a/curs_main.c +++ b/curs_main.c @@ -481,7 +481,7 @@ void update_index (MUTTMENU *menu, CONTEXT *ctx, int check, } /* save the list of new messages */ - if (oldcount && check != MUTT_REOPENED + if (option(OPTUNCOLLAPSENEW) && oldcount && check != MUTT_REOPENED && ((Sort & SORT_MASK) == SORT_THREADS)) { save_new = (HEADER **) safe_malloc (sizeof (HEADER *) * (ctx->msgcount - oldcount)); @@ -493,7 +493,7 @@ void update_index (MUTTMENU *menu, CONTEXT *ctx, int check, mutt_sort_headers (ctx, (check == MUTT_REOPENED)); /* uncollapse threads with new mail */ - if ((Sort & SORT_MASK) == SORT_THREADS) + if (option(OPTUNCOLLAPSENEW) && ((Sort & SORT_MASK) == SORT_THREADS)) { if (check == MUTT_REOPENED) { diff --git a/init.h b/init.h index e146a66ba..add06ad8f 100644 --- a/init.h +++ b/init.h @@ -4047,6 +4047,14 @@ struct option_t MuttVars[] = { ** When \fIset\fP, Mutt will jump to the next unread message, if any, ** when the current thread is \fIun\fPcollapsed. */ + { "uncollapse_new", DT_BOOL, R_NONE, OPTUNCOLLAPSENEW, 1 }, + /* + ** .pp + ** When \fIset\fP, Mutt will automatically uncollapse any collapsed thread + ** that receives a new message. When \fIunset\fP, collapsed threads will + ** remain collapsed. the presence of the new message will still affect + ** index sorting, though. + */ { "use_8bitmime", DT_BOOL, R_NONE, OPTUSE8BITMIME, 0 }, /* ** .pp diff --git a/mutt.h b/mutt.h index bb8d09f3a..1d693e0c7 100644 --- a/mutt.h +++ b/mutt.h @@ -514,6 +514,7 @@ enum OPTTILDE, OPTTSENABLED, OPTUNCOLLAPSEJUMP, + OPTUNCOLLAPSENEW, OPTUSE8BITMIME, OPTUSEDOMAIN, OPTUSEFROM, -- 2.40.0