From b89aeaca97def49cb058d997187ed18b7bcb73d4 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 21 Oct 2019 13:07:48 +0100 Subject: [PATCH] eliminate MuttIndexWindow from mutt_display_message() Pass `mutt_display_message()` a `MuttWindow` to work with, rather than using the global `MuttIndexWindow`. --- commands.c | 11 ++++++----- commands.h | 3 ++- index.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/commands.c b/commands.c index 1333c33bf..43205452e 100644 --- a/commands.c +++ b/commands.c @@ -187,12 +187,13 @@ static void process_protected_headers(struct Email *e) /** * mutt_display_message - Display a message in the pager - * @param m Mailbox - * @param e Email to display + * @param win Window + * @param m Mailbox + * @param e Email to display * @retval 0 Success * @retval -1 Error */ -int mutt_display_message(struct Mailbox *m, struct Email *e) +int mutt_display_message(struct MuttWindow *win, struct Mailbox *m, struct Email *e) { int rc = 0; bool builtin = false; @@ -278,7 +279,7 @@ int mutt_display_message(struct Mailbox *m, struct Email *e) hfi.mailbox = m; hfi.pager_progress = ExtPagerProgress; hfi.email = e; - mutt_make_string_info(buf, sizeof(buf), MuttIndexWindow->cols, + mutt_make_string_info(buf, sizeof(buf), win->cols, NONULL(C_PagerFormat), &hfi, MUTT_FORMAT_NO_FLAGS); fputs(buf, fp_out); fputs("\n\n", fp_out); @@ -289,7 +290,7 @@ int mutt_display_message(struct Mailbox *m, struct Email *e) if (m->magic == MUTT_NOTMUCH) chflags |= CH_VIRTUAL; #endif - res = mutt_copy_message(fp_out, m, e, cmflags, chflags, MuttIndexWindow->cols); + res = mutt_copy_message(fp_out, m, e, cmflags, chflags, win->cols); if (((mutt_file_fclose(&fp_out) != 0) && (errno != EPIPE)) || (res < 0)) { diff --git a/commands.h b/commands.h index eba104e09..21770d44f 100644 --- a/commands.h +++ b/commands.h @@ -32,6 +32,7 @@ struct Email; struct EmailList; struct Envelope; struct Mailbox; +struct MuttWindow; /* These Config Variables are only used in commands.c */ extern unsigned char C_CryptVerifySig; /* verify PGP signatures */ @@ -47,7 +48,7 @@ void ci_bounce_message(struct Mailbox *m, struct EmailList *el); void mutt_check_stats(void); bool mutt_check_traditional_pgp(struct EmailList *el, MuttRedrawFlags *redraw); void mutt_display_address(struct Envelope *env); -int mutt_display_message(struct Mailbox *m, struct Email *e); +int mutt_display_message(struct MuttWindow *win, struct Mailbox *m, struct Email *e); bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp); void mutt_enter_command(void); void mutt_pipe_message(struct Mailbox *m, struct EmailList *el); diff --git a/index.c b/index.c index e4f72d312..4fd6b1d82 100644 --- a/index.c +++ b/index.c @@ -2374,7 +2374,7 @@ int mutt_index_menu(void) * set CurrentMenu incorrectly when we return back to the index menu. */ menu->type = MENU_MAIN; - op = mutt_display_message(Context->mailbox, CUR_EMAIL); + op = mutt_display_message(MuttIndexWindow, Context->mailbox, CUR_EMAIL); if (op < 0) { OptNeedResort = false; -- 2.40.0