From c9223a12cdde6f9c1589c422216021b9eae048e1 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Wed, 27 Apr 2016 17:56:59 -0700 Subject: [PATCH] Add cols parameter to mutt_FormatString() Continuing with the conversion to using windows for screen drawing, mutt_FormatString() was directly using COLS for right justification and similar formatting. Instead pass in a parameter, cols. This change involved seeding the parameter through callback functions too, as many of them call mutt_FormatString() back. --- addrbook.c | 4 ++-- browser.c | 8 ++++---- compose.c | 18 +++++++++--------- crypt-gpgme.c | 7 ++++--- hdrline.c | 9 +++++---- muttlib.c | 25 +++++++++++++------------ pgpinvoke.c | 7 ++++--- pgpkey.c | 7 ++++--- protos.h | 5 +++-- query.c | 8 ++++---- recvattach.c | 7 ++++--- remailer.c | 7 ++++--- smime.c | 7 ++++--- status.c | 14 +++++++------- 14 files changed, 71 insertions(+), 62 deletions(-) diff --git a/addrbook.c b/addrbook.c index 8767a00f..aa844f4b 100644 --- a/addrbook.c +++ b/addrbook.c @@ -43,7 +43,7 @@ static const struct mapping_t AliasHelp[] = { }; static const char * -alias_format_str (char *dest, size_t destlen, size_t col, char op, const char *src, +alias_format_str (char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) { @@ -80,7 +80,7 @@ alias_format_str (char *dest, size_t destlen, size_t col, char op, const char *s static void alias_entry (char *s, size_t slen, MUTTMENU *m, int num) { - mutt_FormatString (s, slen, 0, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], M_FORMAT_ARROWCURSOR); + mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], M_FORMAT_ARROWCURSOR); } static int alias_tag (MUTTMENU *menu, int n, int m) diff --git a/browser.c b/browser.c index 46919a0b..bf8f5f94 100644 --- a/browser.c +++ b/browser.c @@ -142,7 +142,7 @@ static int link_is_dir (const char *folder, const char *path) } static const char * -folder_format_str (char *dest, size_t destlen, size_t col, char op, const char *src, +folder_format_str (char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) { @@ -317,9 +317,9 @@ folder_format_str (char *dest, size_t destlen, size_t col, char op, const char * } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, folder_format_str, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, folder_format_str, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, folder_format_str, data, 0); + mutt_FormatString (dest, destlen, col, cols, elsestring, folder_format_str, data, 0); return (src); } @@ -515,7 +515,7 @@ static void folder_entry (char *s, size_t slen, MUTTMENU *menu, int num) folder.ff = &((struct folder_file *) menu->data)[num]; folder.num = num; - mutt_FormatString (s, slen, 0, NONULL(FolderFormat), folder_format_str, + mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str, (unsigned long) &folder, M_FORMAT_ARROWCURSOR); } diff --git a/compose.c b/compose.c index 16084b85..7b9cf7d3 100644 --- a/compose.c +++ b/compose.c @@ -99,7 +99,7 @@ static const struct mapping_t ComposeHelp[] = { static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num) { - mutt_FormatString (b, blen, 0, NONULL (AttachFormat), mutt_attach_fmt, + mutt_FormatString (b, blen, 0, MuttIndexWindow->cols, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long)(((ATTACHPTR **) menu->data)[num]), M_FORMAT_STAT_FILE | M_FORMAT_ARROWCURSOR); } @@ -402,7 +402,7 @@ static unsigned long cum_attachs_size (MUTTMENU *menu) } /* prototype for use below */ -static void compose_status_line (char *buf, size_t buflen, size_t col, MUTTMENU *menu, +static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu, const char *p); /* @@ -418,7 +418,7 @@ static void compose_status_line (char *buf, size_t buflen, size_t col, MUTTMENU */ static const char * -compose_format_str (char *buf, size_t buflen, size_t col, char op, const char *src, +compose_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) @@ -461,17 +461,17 @@ compose_format_str (char *buf, size_t buflen, size_t col, char op, const char *s } if (optional) - compose_status_line (buf, buflen, col, menu, ifstring); + compose_status_line (buf, buflen, col, cols, menu, ifstring); else if (flags & M_FORMAT_OPTIONAL) - compose_status_line (buf, buflen, col, menu, elsestring); + compose_status_line (buf, buflen, col, cols, menu, elsestring); return (src); } -static void compose_status_line (char *buf, size_t buflen, size_t col, MUTTMENU *menu, - const char *p) +static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, + MUTTMENU *menu, const char *p) { - mutt_FormatString (buf, buflen, col, p, compose_format_str, + mutt_FormatString (buf, buflen, col, cols, p, compose_format_str, (unsigned long) menu, 0); } @@ -1313,7 +1313,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ /* Draw formatted compose status line */ if (menu->redraw & REDRAW_STATUS) { - compose_status_line (buf, sizeof (buf), 0, menu, NONULL(ComposeFormat)); + compose_status_line (buf, sizeof (buf), 0, MuttStatusWindow->cols, menu, NONULL(ComposeFormat)); mutt_window_move (MuttStatusWindow, 0, 0); SETCOLOR (MT_COLOR_STATUS); mutt_paddstr (MuttStatusWindow->cols, buf); diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 479b58ab..7173f422 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -2744,6 +2744,7 @@ int smime_gpgme_application_handler (BODY *a, STATE *s) static const char *crypt_entry_fmt (char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, @@ -2941,9 +2942,9 @@ static const char *crypt_entry_fmt (char *dest, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return (src); } @@ -2956,7 +2957,7 @@ static void crypt_entry (char *s, size_t l, MUTTMENU * menu, int num) entry.key = key_table[num]; entry.num = num + 1; - mutt_FormatString (s, l, 0, NONULL (PgpEntryFormat), crypt_entry_fmt, + mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), crypt_entry_fmt, (unsigned long) &entry, M_FORMAT_ARROWCURSOR); } diff --git a/hdrline.c b/hdrline.c index b844411e..7cf90953 100644 --- a/hdrline.c +++ b/hdrline.c @@ -236,6 +236,7 @@ static const char * hdr_format_str (char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, @@ -735,9 +736,9 @@ hdr_format_str (char *dest, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, hdr_format_str, (unsigned long) hfi, flags); + mutt_FormatString (dest, destlen, col, cols, ifstring, hdr_format_str, (unsigned long) hfi, flags); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, hdr_format_str, (unsigned long) hfi, flags); + mutt_FormatString (dest, destlen, col, cols, elsestring, hdr_format_str, (unsigned long) hfi, flags); return (src); #undef THREAD_NEW @@ -753,11 +754,11 @@ _mutt_make_string (char *dest, size_t destlen, const char *s, CONTEXT *ctx, HEAD hfi.ctx = ctx; hfi.pager_progress = 0; - mutt_FormatString (dest, destlen, 0, s, hdr_format_str, (unsigned long) &hfi, flags); + mutt_FormatString (dest, destlen, 0, MuttIndexWindow->cols, s, hdr_format_str, (unsigned long) &hfi, flags); } void mutt_make_string_info (char *dst, size_t dstlen, const char *s, struct hdr_format_info *hfi, format_flag flags) { - mutt_FormatString (dst, dstlen, 0, s, hdr_format_str, (unsigned long) hfi, flags); + mutt_FormatString (dst, dstlen, 0, MuttIndexWindow->cols, s, hdr_format_str, (unsigned long) hfi, flags); } diff --git a/muttlib.c b/muttlib.c index b18e3d91..58954fde 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1053,6 +1053,7 @@ void mutt_safe_path (char *s, size_t l, ADDRESS *a) void mutt_FormatString (char *dest, /* output buffer */ size_t destlen, /* output buffer len */ size_t col, /* starting column (nonzero when called recursively) */ + int cols, /* maximum columns */ const char *src, /* template string */ format_t *callback, /* callback for processing */ unsigned long data, /* callback data */ @@ -1117,7 +1118,7 @@ void mutt_FormatString (char *dest, /* output buffer */ mutt_extract_token(word, srcbuf, 0); dprint(3, (debugfile, "fmtpipe %2d: %s\n", i++, word->data)); mutt_buffer_addch(command, '\''); - mutt_FormatString(buf, sizeof(buf), 0, word->data, callback, data, + mutt_FormatString(buf, sizeof(buf), 0, cols, word->data, callback, data, flags | M_FORMAT_NOFILTER); for (p = buf; p && *p; p++) { @@ -1172,7 +1173,7 @@ void mutt_FormatString (char *dest, /* output buffer */ * it back for the recursive call since the expansion of * format pipes does not try to append a nul itself. */ - mutt_FormatString(dest, destlen+1, col, recycler, callback, data, flags); + mutt_FormatString(dest, destlen+1, col, cols, recycler, callback, data, flags); FREE(&recycler); } } @@ -1282,16 +1283,16 @@ void mutt_FormatString (char *dest, /* output buffer */ pl = pw = 1; /* see if there's room to add content, else ignore */ - if ((col < COLS && wlen < destlen) || soft) + if ((col < cols && wlen < destlen) || soft) { int pad; /* get contents after padding */ - mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags); + mutt_FormatString (buf, sizeof (buf), 0, cols, src + pl, callback, data, flags); len = mutt_strlen (buf); wid = mutt_strwidth (buf); - pad = (COLS - col - wid) / pw; + pad = (cols - col - wid) / pw; if (pad >= 0) { /* try to consume as many columns as we can, if we don't have @@ -1302,7 +1303,7 @@ void mutt_FormatString (char *dest, /* output buffer */ { /* Add pre-spacing to make multi-column pad characters and * the contents after padding line up */ - while ((col + (pad * pw) + wid < COLS) && + while ((col + (pad * pw) + wid < cols) && (wlen + (pad * pl) + len < destlen)) { *wptr++ = ' '; @@ -1321,7 +1322,7 @@ void mutt_FormatString (char *dest, /* output buffer */ else if (soft && pad < 0) { int offset = ((flags & M_FORMAT_ARROWCURSOR) && option (OPTARROWCURSOR)) ? 3 : 0; - int avail_cols = (COLS > offset) ? (COLS - offset) : 0; + int avail_cols = (cols > offset) ? (cols - offset) : 0; /* \0-terminate dest for length computation in mutt_wstr_trunc() */ *wptr = 0; /* make sure right part is at most as wide as display */ @@ -1339,7 +1340,7 @@ void mutt_FormatString (char *dest, /* output buffer */ } } if (len + wlen > destlen) - len = mutt_wstr_trunc (buf, destlen - wlen, COLS - col, NULL); + len = mutt_wstr_trunc (buf, destlen - wlen, cols - col, NULL); memcpy (wptr, buf, len); wptr += len; wlen += len; @@ -1356,9 +1357,9 @@ void mutt_FormatString (char *dest, /* output buffer */ pl = pw = 1; /* see if there's room to add content, else ignore */ - if (col < COLS && wlen < destlen) + if (col < cols && wlen < destlen) { - c = (COLS - col) / pw; + c = (cols - col) / pw; if (c > 0 && wlen + (c * pl) > destlen) c = ((signed)(destlen - wlen)) / pl; while (c > 0) @@ -1389,7 +1390,7 @@ void mutt_FormatString (char *dest, /* output buffer */ } /* use callback function to handle this case */ - src = callback (buf, sizeof (buf), col, ch, src, prefix, ifstring, elsestring, data, flags); + src = callback (buf, sizeof (buf), col, cols, ch, src, prefix, ifstring, elsestring, data, flags); if (tolower) mutt_strlower (buf); @@ -1402,7 +1403,7 @@ void mutt_FormatString (char *dest, /* output buffer */ } if ((len = mutt_strlen (buf)) + wlen > destlen) - len = mutt_wstr_trunc (buf, destlen - wlen, COLS - col, NULL); + len = mutt_wstr_trunc (buf, destlen - wlen, cols - col, NULL); memcpy (wptr, buf, len); wptr += len; diff --git a/pgpinvoke.c b/pgpinvoke.c index 73341922..cf7e6c92 100644 --- a/pgpinvoke.c +++ b/pgpinvoke.c @@ -59,6 +59,7 @@ struct pgp_command_context { const char *_mutt_fmt_pgp_command (char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, @@ -140,16 +141,16 @@ const char *_mutt_fmt_pgp_command (char *dest, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, _mutt_fmt_pgp_command, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, _mutt_fmt_pgp_command, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, _mutt_fmt_pgp_command, data, 0); + mutt_FormatString (dest, destlen, col, cols, elsestring, _mutt_fmt_pgp_command, data, 0); return (src); } void mutt_pgp_command (char *d, size_t dlen, struct pgp_command_context *cctx, const char *fmt) { - mutt_FormatString (d, dlen, 0, NONULL (fmt), _mutt_fmt_pgp_command, (unsigned long) cctx, 0); + mutt_FormatString (d, dlen, 0, MuttIndexWindow->cols, NONULL (fmt), _mutt_fmt_pgp_command, (unsigned long) cctx, 0); dprint (2, (debugfile, "mutt_pgp_command: %s\n", d)); } diff --git a/pgpkey.c b/pgpkey.c index 80bd7de2..cdaa0363 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -122,6 +122,7 @@ typedef struct pgp_entry static const char *pgp_entry_fmt (char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, @@ -278,9 +279,9 @@ static const char *pgp_entry_fmt (char *dest, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return (src); } @@ -292,7 +293,7 @@ static void pgp_entry (char *s, size_t l, MUTTMENU * menu, int num) entry.uid = KeyTable[num]; entry.num = num + 1; - mutt_FormatString (s, l, 0, NONULL (PgpEntryFormat), pgp_entry_fmt, + mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), pgp_entry_fmt, (unsigned long) &entry, M_FORMAT_ARROWCURSOR); } diff --git a/protos.h b/protos.h index 06fab413..0eebe958 100644 --- a/protos.h +++ b/protos.h @@ -71,9 +71,9 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *hdr, int flag); #define mutt_new_envelope() safe_calloc (1, sizeof (ENVELOPE)) #define mutt_new_enter_state() safe_calloc (1, sizeof (ENTER_STATE)) -typedef const char * format_t (char *, size_t, size_t, char, const char *, const char *, const char *, const char *, unsigned long, format_flag); +typedef const char * format_t (char *, size_t, size_t, int, char, const char *, const char *, const char *, const char *, unsigned long, format_flag); -void mutt_FormatString (char *, size_t, size_t, const char *, format_t *, unsigned long, format_flag); +void mutt_FormatString (char *, size_t, size_t, int, const char *, format_t *, unsigned long, format_flag); void mutt_parse_content_type (char *, BODY *); void mutt_generate_boundary (PARAMETER **); void mutt_delete_parameter (const char *attribute, PARAMETER **p); @@ -127,6 +127,7 @@ const char *mutt_attach_fmt ( char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, diff --git a/query.c b/query.c index 8bcffbd0..361b38ec 100644 --- a/query.c +++ b/query.c @@ -183,7 +183,7 @@ static int query_search (MUTTMENU *m, regex_t *re, int n) return REG_NOMATCH; } -static const char * query_format_str (char *dest, size_t destlen, size_t col, +static const char * query_format_str (char *dest, size_t destlen, size_t col, int cols, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, @@ -230,9 +230,9 @@ static const char * query_format_str (char *dest, size_t destlen, size_t col, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, query_format_str, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, query_format_str, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, query_format_str, data, 0); + mutt_FormatString (dest, destlen, col, cols, elsestring, query_format_str, data, 0); return src; } @@ -242,7 +242,7 @@ static void query_entry (char *s, size_t slen, MUTTMENU *m, int num) ENTRY *entry = &((ENTRY *) m->data)[num]; entry->data->num = num; - mutt_FormatString (s, slen, 0, NONULL (QueryFormat), query_format_str, + mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL (QueryFormat), query_format_str, (unsigned long) entry, M_FORMAT_ARROWCURSOR); } diff --git a/recvattach.c b/recvattach.c index 0669038b..da34ba67 100644 --- a/recvattach.c +++ b/recvattach.c @@ -173,6 +173,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY *m, const char *mutt_attach_fmt (char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, @@ -365,15 +366,15 @@ const char *mutt_attach_fmt (char *dest, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return (src); } static void attach_entry (char *b, size_t blen, MUTTMENU *menu, int num) { - mutt_FormatString (b, blen, 0, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **)menu->data)[num]), M_FORMAT_ARROWCURSOR); + mutt_FormatString (b, blen, 0, MuttIndexWindow->cols, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **)menu->data)[num]), M_FORMAT_ARROWCURSOR); } int mutt_tag_attach (MUTTMENU *menu, int n, int m) diff --git a/remailer.c b/remailer.c index aea933bf..51384f72 100644 --- a/remailer.c +++ b/remailer.c @@ -377,6 +377,7 @@ static const char *mix_format_caps (REMAILER *r) static const char *mix_entry_fmt (char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, @@ -429,9 +430,9 @@ static const char *mix_entry_fmt (char *dest, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, mutt_attach_fmt, data, 0); + mutt_FormatString (dest, destlen, col, cols, elsestring, mutt_attach_fmt, data, 0); return (src); } @@ -440,7 +441,7 @@ static const char *mix_entry_fmt (char *dest, static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num) { REMAILER **type2_list = (REMAILER **) menu->data; - mutt_FormatString (b, blen, 0, NONULL (MixEntryFormat), mix_entry_fmt, + mutt_FormatString (b, blen, 0, MuttIndexWindow->cols, NONULL (MixEntryFormat), mix_entry_fmt, (unsigned long) type2_list[num], M_FORMAT_ARROWCURSOR); } diff --git a/smime.c b/smime.c index 7f9a8b53..897c9e03 100644 --- a/smime.c +++ b/smime.c @@ -159,6 +159,7 @@ int smime_valid_passphrase (void) static const char *_mutt_fmt_smime_command (char *dest, size_t destlen, size_t col, + int cols, char op, const char *src, const char *prefix, @@ -284,10 +285,10 @@ static const char *_mutt_fmt_smime_command (char *dest, } if (optional) - mutt_FormatString (dest, destlen, col, ifstring, _mutt_fmt_smime_command, + mutt_FormatString (dest, destlen, col, cols, ifstring, _mutt_fmt_smime_command, data, 0); else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, col, elsestring, _mutt_fmt_smime_command, + mutt_FormatString (dest, destlen, col, cols, elsestring, _mutt_fmt_smime_command, data, 0); return (src); @@ -298,7 +299,7 @@ static const char *_mutt_fmt_smime_command (char *dest, static void mutt_smime_command (char *d, size_t dlen, struct smime_command_context *cctx, const char *fmt) { - mutt_FormatString (d, dlen, 0, NONULL(fmt), _mutt_fmt_smime_command, + mutt_FormatString (d, dlen, 0, MuttIndexWindow->cols, NONULL(fmt), _mutt_fmt_smime_command, (unsigned long) cctx, 0); dprint (2,(debugfile, "mutt_smime_command: %s\n", d)); } diff --git a/status.c b/status.c index 6051e3af..c9fccb3e 100644 --- a/status.c +++ b/status.c @@ -40,7 +40,7 @@ static char *get_sort_str (char *buf, size_t buflen, int method) return buf; } -static void _menu_status_line (char *buf, size_t buflen, size_t col, MUTTMENU *menu, const char *p); +static void _menu_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu, const char *p); /* %b = number of incoming folders with unread messages [option] * %d = number of deleted messages [option] @@ -62,7 +62,7 @@ static void _menu_status_line (char *buf, size_t buflen, size_t col, MUTTMENU *m * %v = Mutt version * %V = currently active limit pattern [option] */ static const char * -status_format_str (char *buf, size_t buflen, size_t col, char op, const char *src, +status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prefix, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) @@ -290,19 +290,19 @@ status_format_str (char *buf, size_t buflen, size_t col, char op, const char *sr } if (optional) - _menu_status_line (buf, buflen, col, menu, ifstring); + _menu_status_line (buf, buflen, col, cols, menu, ifstring); else if (flags & M_FORMAT_OPTIONAL) - _menu_status_line (buf, buflen, col, menu, elsestring); + _menu_status_line (buf, buflen, col, cols, menu, elsestring); return (src); } -static void _menu_status_line (char *buf, size_t buflen, size_t col, MUTTMENU *menu, const char *p) +static void _menu_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu, const char *p) { - mutt_FormatString (buf, buflen, col, p, status_format_str, (unsigned long) menu, 0); + mutt_FormatString (buf, buflen, col, cols, p, status_format_str, (unsigned long) menu, 0); } void menu_status_line (char *buf, size_t buflen, MUTTMENU *menu, const char *p) { - mutt_FormatString (buf, buflen, 0, p, status_format_str, (unsigned long) menu, 0); + mutt_FormatString (buf, buflen, 0, MuttStatusWindow->cols, p, status_format_str, (unsigned long) menu, 0); } -- 2.40.0