From: Pierre Habouzit Date: Sat, 2 Dec 2006 20:18:33 +0000 (+0100) Subject: let the caller deal with M_FORMAT_ARROWCURSOR, not the callee. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=3242c00b2d3f7f1c1554bcebfb8a390fddea095f;p=apps%2Fmadmutt.git let the caller deal with M_FORMAT_ARROWCURSOR, not the callee. Signed-off-by: Pierre Habouzit --- diff --git a/alias.c b/alias.c index 201cb0e..24b8b36 100644 --- a/alias.c +++ b/alias.c @@ -517,7 +517,7 @@ static void alias_entry (char *s, ssize_t slen, MUTTMENU * m, int num) { m_strformat (s, slen, NONULL (AliasFmt), (format_t *)alias_format_str, (unsigned long)((alias_t **)m->data)[num], - M_FORMAT_ARROWCURSOR); + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); } static int alias_tag (MUTTMENU * menu, int n, int m) diff --git a/browser.c b/browser.c index 47c4b3f..4af5dca 100644 --- a/browser.c +++ b/browser.c @@ -645,12 +645,14 @@ static void folder_entry (char *s, ssize_t slen, MUTTMENU * menu, int num) #ifdef USE_NNTP if (option (OPTNEWS)) - m_strformat (s, slen, NONULL (GroupFormat), newsgroup_format_str, - (unsigned long) &folder, M_FORMAT_ARROWCURSOR); + m_strformat(s, slen, NONULL (GroupFormat), newsgroup_format_str, + (unsigned long)&folder, + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); else #endif - m_strformat (s, slen, NONULL (FolderFormat), folder_format_str, - (unsigned long) &folder, M_FORMAT_ARROWCURSOR); + m_strformat(s, slen, NONULL (FolderFormat), folder_format_str, + (unsigned long)&folder, + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); } static void init_menu (struct browser_state *state, MUTTMENU * menu, diff --git a/compose.c b/compose.c index 860d643..d1a6098 100644 --- a/compose.c +++ b/compose.c @@ -116,7 +116,7 @@ static void snd_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) { int w=(COLS-SW)>blen?blen:COLS-SW; m_strformat (b, w, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **) menu->data)[num]), - M_FORMAT_STAT_FILE | M_FORMAT_ARROWCURSOR); + M_FORMAT_STAT_FILE | (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0)); } static void redraw_crypt_lines (HEADER * msg) @@ -461,8 +461,7 @@ static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu, const char *p) { int w=(COLS-SW)>buflen?buflen:(COLS-SW); - m_strformat (buf, w, p, compose_format_str, - (unsigned long) menu, 0); + m_strformat(buf, w, p, compose_format_str, (unsigned long)menu, 0); } /* return values: diff --git a/lib-crypt/crypt-gpgme.c b/lib-crypt/crypt-gpgme.c index 700f9d3..7b85ab6 100644 --- a/lib-crypt/crypt-gpgme.c +++ b/lib-crypt/crypt-gpgme.c @@ -2324,8 +2324,9 @@ static void crypt_entry (char *s, ssize_t l, MUTTMENU * menu, int num) entry.key = key_table[num]; entry.num = num + 1; - m_strformat (s, l, NONULL (PgpEntryFormat), crypt_entry_fmt, - (unsigned long) &entry, M_FORMAT_ARROWCURSOR); + m_strformat(s, l, NONULL (PgpEntryFormat), crypt_entry_fmt, + (unsigned long) &entry, + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); } /* Compare two addresses and the keyid to be used for sorting. */ diff --git a/lib-crypt/pgpinvoke.c b/lib-crypt/pgpinvoke.c index 312f59e..a8f0bb8 100644 --- a/lib-crypt/pgpinvoke.c +++ b/lib-crypt/pgpinvoke.c @@ -108,11 +108,9 @@ _mutt_fmt_pgp_command(char *dest, ssize_t destlen, } if (optional) - m_strformat (dest, destlen, ifstring, _mutt_fmt_pgp_command, data, - 0); + m_strformat(dest, destlen, ifstring, _mutt_fmt_pgp_command, data, 0); else if (flags & M_FORMAT_OPTIONAL) - m_strformat (dest, destlen, elsestring, _mutt_fmt_pgp_command, data, - 0); + m_strformat(dest, destlen, elsestring, _mutt_fmt_pgp_command, data, 0); return (src); } diff --git a/lib-crypt/pgpkey.c b/lib-crypt/pgpkey.c index c0a06f2..44facd6 100644 --- a/lib-crypt/pgpkey.c +++ b/lib-crypt/pgpkey.c @@ -250,8 +250,9 @@ static void pgp_entry (char *s, ssize_t l, MUTTMENU * menu, int num) entry.uid = KeyTable[num]; entry.num = num + 1; - m_strformat (s, l, NONULL (PgpEntryFormat), pgp_entry_fmt, - (unsigned long) &entry, M_FORMAT_ARROWCURSOR); + m_strformat(s, l, NONULL (PgpEntryFormat), pgp_entry_fmt, + (unsigned long)&entry, + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); } static int _pgp_compare_address (const void *a, const void *b) diff --git a/lib-crypt/smime.c b/lib-crypt/smime.c index 555c8e9..bbaa198 100644 --- a/lib-crypt/smime.c +++ b/lib-crypt/smime.c @@ -219,11 +219,9 @@ _mutt_fmt_smime_command (char *dest, ssize_t destlen, char op, } if (optional) - m_strformat (dest, destlen, ifstring, _mutt_fmt_smime_command, - data, 0); + m_strformat(dest, destlen, ifstring, _mutt_fmt_smime_command, data, 0); else if (flags & M_FORMAT_OPTIONAL) - m_strformat (dest, destlen, elsestring, _mutt_fmt_smime_command, - data, 0); + m_strformat(dest, destlen, elsestring, _mutt_fmt_smime_command, data, 0); return (src); } @@ -234,8 +232,8 @@ static void mutt_smime_command (char *d, ssize_t dlen, struct smime_command_context *cctx, const char *fmt) { - m_strformat (d, dlen, NONULL (fmt), _mutt_fmt_smime_command, - (unsigned long) cctx, 0); + m_strformat(d, dlen, NONULL (fmt), _mutt_fmt_smime_command, + (unsigned long)cctx, 0); } static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout, diff --git a/lib-mx/compress.c b/lib-mx/compress.c index 37090fb..00064b7 100644 --- a/lib-mx/compress.c +++ b/lib-mx/compress.c @@ -171,8 +171,8 @@ static char *get_compression_cmd (const char *cmd, const CONTEXT * ctx) { char expanded[_POSIX_PATH_MAX]; - m_strformat (expanded, sizeof (expanded), cmd, - compresshook_format_str, (unsigned long) ctx, 0); + m_strformat(expanded, sizeof (expanded), cmd, compresshook_format_str, + (unsigned long)ctx, 0); return m_strdup(expanded); } diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index f9e7c33..71af8bd 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -97,12 +97,14 @@ extern size_t UngetCount; void index_make_entry (char *s, ssize_t l, struct menu_t * menu, int num) { - format_flag flag = - M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX; + format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_INDEX; int edgemsgno, reverse = Sort & SORT_REVERSE; HEADER *h = Context->hdrs[Context->v2r[num]]; THREAD *tmp; + if (option(OPTARROWCURSOR)) + flag |= M_FORMAT_ARROWCURSOR; + if ((Sort & SORT_MASK) == SORT_THREADS && h->tree) { flag |= M_FORMAT_TREE; /* display the thread tree */ if (h->display_subject) diff --git a/lib-ui/hdrline.c b/lib-ui/hdrline.c index 6a4f7ea..3d22756 100644 --- a/lib-ui/hdrline.c +++ b/lib-ui/hdrline.c @@ -707,11 +707,11 @@ static const char *hdr_format_str (char *dest, } if (optional) - m_strformat (dest, destlen, ifstring, hdr_format_str, - (unsigned long) hfi, flags); + m_strformat(dest, destlen, ifstring, hdr_format_str, + (unsigned long)hfi, flags); else if (flags & M_FORMAT_OPTIONAL) - m_strformat (dest, destlen, elsestring, hdr_format_str, - (unsigned long) hfi, flags); + m_strformat(dest, destlen, elsestring, hdr_format_str, + (unsigned long)hfi, flags); return (src); #undef THREAD_NEW @@ -727,6 +727,5 @@ _mutt_make_string (char *dest, ssize_t destlen, const char *s, CONTEXT * ctx, hfi.hdr = hdr; hfi.ctx = ctx; - m_strformat (dest, destlen, s, hdr_format_str, (unsigned long) &hfi, - flags); + m_strformat(dest, destlen, s, hdr_format_str, (unsigned long) &hfi, flags); } diff --git a/muttlib.c b/muttlib.c index f185e12..9c108b7 100644 --- a/muttlib.c +++ b/muttlib.c @@ -331,7 +331,7 @@ void mutt_safe_path(char *s, ssize_t l, address_t *a) ssize_t m_strformat(char *dst, ssize_t dlen, const char *fmt, format_t *callback, unsigned long data, format_flag flags) { - ssize_t pos = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0; + ssize_t pos = flags & M_FORMAT_ARROWCURSOR ? 3 : 0; while (*fmt) { char ifstring[STRING], elsestring[STRING], prefix[STRING] = ""; @@ -403,13 +403,9 @@ ssize_t m_strformat(char *dst, ssize_t dlen, const char *fmt, } return pos; /* skip rest of input */ - case '|': - col = mutt_strwidth(dst); - - ch = *fmt++; - /* pad to EOL */ - pos += m_strpad(dst + pos, dlen - pos, ch, COLS - SW - col); - return pos; /* skip rest of input */ + case '|': /* pad to EOL */ + return pos + m_strpad(dst + pos, dlen - pos, *fmt, + COLS - SW - mutt_strwidth(dst)); default: lower = nodots = 0; diff --git a/postpone.c b/postpone.c index 635abd2..a2e03b0 100644 --- a/postpone.c +++ b/postpone.c @@ -135,7 +135,7 @@ static void post_entry (char *s, ssize_t slen, MUTTMENU * menu, int entry) CONTEXT *ctx = (CONTEXT *) menu->data; _mutt_make_string (s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry], - M_FORMAT_ARROWCURSOR); + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); } static HEADER *select_msg (void) diff --git a/recvattach.c b/recvattach.c index 50d3601..ab21e54 100644 --- a/recvattach.c +++ b/recvattach.c @@ -191,7 +191,7 @@ const char *mutt_attach_fmt (char *dest, _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr, M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT | - M_FORMAT_ARROWCURSOR); + (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0)); if (*s) { mutt_format_s (dest, destlen, prefix, s); break; @@ -324,7 +324,7 @@ static void attach_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) int w=(COLS-SW)>blen?blen:(COLS-SW); m_strformat (b, w, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **) menu->data)[num]), - M_FORMAT_ARROWCURSOR); + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); } int mutt_tag_attach (MUTTMENU * menu, int n, int m) diff --git a/remailer.c b/remailer.c index 40f5bba..bfb66b1 100644 --- a/remailer.c +++ b/remailer.c @@ -401,8 +401,9 @@ static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) remailer_t **type2_list = (remailer_t **) menu->data; int w = (COLS-SW) > blen ? blen : (COLS-SW); - m_strformat (b, w, NONULL (MixEntryFormat), mix_entry_fmt, - (unsigned long) type2_list[num], M_FORMAT_ARROWCURSOR); + m_strformat(b, w, NONULL (MixEntryFormat), mix_entry_fmt, + (unsigned long) type2_list[num], + option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0); } static int mix_chain_add (mixchain_t * chain, const char *s,