Commit 31beda39 authored by Thomas Roessler's avatar Thomas Roessler

[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 <gero@faveve.uni-stuttgart.de>)
parent b6a56b30
......@@ -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)
......
......@@ -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)
{
......
......@@ -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]];
......
......@@ -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 == '%')
......
......@@ -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() */
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment