From 8ab43246b42f934c5adc3c49ee794102ca303c07 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 27 Aug 1998 19:37:10 +0000 Subject: [PATCH] [patch-0.94.4i.gt.arrowcursor.1] Padding to the end of line/right jusitifying does not work in menus when $arrow_cursor is set, because the extra space needed for the arrow is not taken into account. (From Gero Treuner ) --- addrbook.c | 2 +- browser.c | 5 +++-- curs_main.c | 2 +- lib.c | 4 +++- mutt.h | 3 ++- postpone.c | 3 ++- recvattach.c | 4 ++-- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/addrbook.c b/addrbook.c index 9334796b5..f589079a4 100644 --- a/addrbook.c +++ b/addrbook.c @@ -80,7 +80,7 @@ int alias_search (MUTTMENU *m, regex_t *re, int n) void alias_entry (char *s, size_t slen, MUTTMENU *m, int num) { - mutt_FormatString (s, slen, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], 0); + mutt_FormatString (s, slen, NONULL (AliasFmt), alias_format_str, (unsigned long) ((ALIAS **) m->data)[num], M_FORMAT_ARROWCURSOR); } int alias_tag (MUTTMENU *menu, int n) diff --git a/browser.c b/browser.c index a90d51735..d1d67d3dd 100644 --- a/browser.c +++ b/browser.c @@ -295,8 +295,9 @@ static void add_folder (MUTTMENU *m, struct browser_state *state, folder.name = name; folder.f = s; folder.new = new; - mutt_FormatString (buffer, sizeof (buffer), NONULL(FolderFormat), folder_format_str, - (unsigned long) &folder, 0); + mutt_FormatString (buffer, sizeof (buffer), NONULL(FolderFormat), + folder_format_str, (unsigned long) &folder, + M_FORMAT_ARROWCURSOR); if (state->entrylen == state->entrymax) { diff --git a/curs_main.c b/curs_main.c index d1be5a8bf..401a18b71 100644 --- a/curs_main.c +++ b/curs_main.c @@ -74,7 +74,7 @@ extern const char *ReleaseDate; void index_make_entry (char *s, size_t l, MUTTMENU *menu, int num) { - format_flag flag = M_FORMAT_MAKEPRINT; + format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR; int reverse = Sort & SORT_REVERSE, edgemsgno; HEADER *tmp, *h = Context->hdrs[Context->v2r[num]]; diff --git a/lib.c b/lib.c index c5bb3e392..45d901d35 100644 --- a/lib.c +++ b/lib.c @@ -885,9 +885,11 @@ void mutt_FormatString (char *dest, /* output buffer */ { char prefix[SHORT_STRING], buf[LONG_STRING], *cp, *wptr = dest, ch; char ifstring[SHORT_STRING], elsestring[SHORT_STRING]; - size_t wlen = 0, count, len; + size_t wlen, count, len; destlen--; /* save room for the terminal \0 */ + wlen = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0; + while (*src && wlen < destlen) { if (*src == '%') diff --git a/mutt.h b/mutt.h index 2b7bc5f69..d68f60ad0 100644 --- a/mutt.h +++ b/mutt.h @@ -99,7 +99,8 @@ typedef enum M_FORMAT_TREE = (1<<1), /* draw the thread tree */ M_FORMAT_MAKEPRINT = (1<<2), /* make sure that all chars are printable */ M_FORMAT_OPTIONAL = (1<<3), - M_FORMAT_STAT_FILE = (1<<4) /* used by mutt_attach_fmt */ + M_FORMAT_STAT_FILE = (1<<4), /* used by mutt_attach_fmt */ + M_FORMAT_ARROWCURSOR = (1<<5) /* reserve space for arrow_cursor */ } format_flag; /* types for mutt_add_hook() */ diff --git a/postpone.c b/postpone.c index 0ef74fbe8..5062507e1 100644 --- a/postpone.c +++ b/postpone.c @@ -94,7 +94,8 @@ static void post_entry (char *s, size_t slen, MUTTMENU *menu, int entry) { CONTEXT *ctx = (CONTEXT *) menu->data; - mutt_make_string (s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry]); + _mutt_make_string (s, slen, NONULL (HdrFmt), ctx, ctx->hdrs[entry], + M_FORMAT_ARROWCURSOR); } static HEADER *select_msg (void) diff --git a/recvattach.c b/recvattach.c index cd16309d0..585fb56ab 100644 --- a/recvattach.c +++ b/recvattach.c @@ -170,7 +170,7 @@ const char *mutt_attach_fmt (char *dest, { char s[SHORT_STRING]; _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr, - M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT); + M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR); if (*s) { snprintf (dest, destlen, fmt, s); @@ -243,7 +243,7 @@ const char *mutt_attach_fmt (char *dest, void attach_entry (char *b, size_t blen, MUTTMENU *menu, int num) { - mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **)menu->data)[num]), 0); + mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt, (unsigned long) (((ATTACHPTR **)menu->data)[num]), M_FORMAT_ARROWCURSOR); } int mutt_tag_attach (MUTTMENU *menu, int n) -- 2.40.0