From b1c1eb2155e5a05f2f228a2475f42aba4a9ef549 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sat, 8 Apr 2017 14:18:26 -0700 Subject: [PATCH] Silence imap progress messages for pipe-message. (see #3929) _mutt_pipe_message() calls endwin(), and then calls pipe_msg(). If an imap message body hasn't already been downloaded, this can end up calling imap_fetch_message(). The progress messages in imap_fetch_message() were restoring curses, just after extract_url was running. This was leading to a condition where mutt curses didn't think the screen had changed after extract_url exited. There was already a check for isendwin() inside imap_fetch_message(), but it wasn't wrapped around the progressbar creation/usage. Add a check for those places too. --- imap/message.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/imap/message.c b/imap/message.c index bd03bd49..db666731 100644 --- a/imap/message.c +++ b/imap/message.c @@ -428,6 +428,7 @@ int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno) /* Sam's weird courier server returns an OK response even when FETCH * fails. Thanks Sam. */ short fetched = 0; + int output_progress; idata = (IMAP_DATA*) ctx->data; h = ctx->hdrs[msgno]; @@ -458,7 +459,10 @@ int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno) } } - if (!isendwin()) + /* This function is called in a few places after endwin() + * e.g. _mutt_pipe_message(). */ + output_progress = !isendwin (); + if (output_progress) mutt_message _("Fetching message..."); if (!(msg->fp = msg_cache_put (idata, h))) @@ -516,9 +520,13 @@ int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno) imap_error ("imap_fetch_message()", buf); goto bail; } - mutt_progress_init (&progressbar, _("Fetching message..."), - MUTT_PROGRESS_SIZE, NetInc, bytes); - if (imap_read_literal (msg->fp, idata, bytes, &progressbar) < 0) + if (output_progress) + { + mutt_progress_init (&progressbar, _("Fetching message..."), + MUTT_PROGRESS_SIZE, NetInc, bytes); + } + if (imap_read_literal (msg->fp, idata, bytes, + output_progress ? &progressbar : NULL) < 0) goto bail; /* pick up trailing line */ if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) -- 2.40.0