From 8b727010fe0116a334299f3898e690efd9748170 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 7e45ba68e..c1d4ae760 100644 --- a/curs_main.c +++ b/curs_main.c @@ -390,7 +390,7 @@ static 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)); @@ -402,7 +402,7 @@ static 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 6bec1e9eb..4578974f8 100644 --- a/init.h +++ b/init.h @@ -3639,6 +3639,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 6339613d6..354b15bfd 100644 --- a/mutt.h +++ b/mutt.h @@ -462,6 +462,7 @@ enum OPTTILDE, OPTTSENABLED, OPTUNCOLLAPSEJUMP, + OPTUNCOLLAPSENEW, OPTUSE8BITMIME, OPTUSEDOMAIN, OPTUSEFROM, -- 2.40.0