Commit 1cacc970 authored by Thomas Roessler's avatar Thomas Roessler

Fix pager and index display when non-printable space characters are

encountered.  From EGE.
parent 77065441
......@@ -241,7 +241,7 @@ void ci_bounce_message (HEADER *h, int *redraw)
(h ? _("Bounce message to %s") : _("Bounce messages to %s")), buf);
mutt_format_string (prompt, sizeof (prompt),
0, COLS-extra_space, 0, 0,
prompt, sizeof (prompt));
prompt, sizeof (prompt), 0);
strcat (prompt, "...?");
if (mutt_yesorno (prompt, 1) != 1)
{
......
......@@ -250,7 +250,7 @@ void mutt_curses_error (const char *fmt, ...)
dprint (1, (debugfile, "%s\n", Errorbuf));
mutt_format_string (Errorbuf, sizeof (Errorbuf),
0, COLS-2, 0, 0, Errorbuf, sizeof (Errorbuf));
0, COLS-2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
if (!option (OPTKEEPQUIET))
{
......@@ -274,7 +274,7 @@ void mutt_message (const char *fmt, ...)
va_end (ap);
mutt_format_string (Errorbuf, sizeof (Errorbuf),
0, COLS-2, 0, 0, Errorbuf, sizeof (Errorbuf));
0, COLS-2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
if (!option (OPTKEEPQUIET))
{
......@@ -524,7 +524,8 @@ int mutt_addwch (wchar_t wc)
void mutt_format_string (char *dest, size_t destlen,
int min_width, int max_width,
int right_justify, char pad_char,
const char *s, size_t n)
const char *s, size_t n,
int arboreal)
{
char *p;
wchar_t wc;
......@@ -544,7 +545,7 @@ void mutt_format_string (char *dest, size_t destlen,
k = (k == (size_t)(-1)) ? 1 : n;
wc = replacement_char ();
}
if (wc < M_TREE_MAX)
if (arboreal && wc < M_TREE_MAX)
w = 1; /* hack */
else
{
......@@ -590,10 +591,11 @@ void mutt_format_string (char *dest, size_t destlen,
* the number of character cells when printed.
*/
void mutt_format_s (char *dest,
size_t destlen,
const char *prefix,
const char *s)
static void mutt_format_s_x (char *dest,
size_t destlen,
const char *prefix,
const char *s,
int arboreal)
{
int right_justify = 1;
char *p;
......@@ -612,12 +614,28 @@ void mutt_format_s (char *dest,
}
mutt_format_string (dest, destlen, min_width, max_width,
right_justify, ' ', s, mutt_strlen (s));
right_justify, ' ', s, mutt_strlen (s), arboreal);
}
void mutt_format_s (char *dest,
size_t destlen,
const char *prefix,
const char *s)
{
mutt_format_s_x (dest, destlen, prefix, s, 0);
}
void mutt_format_s_tree (char *dest,
size_t destlen,
const char *prefix,
const char *s)
{
mutt_format_s_x (dest, destlen, prefix, s, 1);
}
/*
* mutt_paddstr (n, s) is almost equivalent to
* mutt_format_string (bigbuf, big, n, n, 0, ' ', s, big), addstr (bigbuf)
* mutt_format_string (bigbuf, big, n, n, 0, ' ', s, big, 0), addstr (bigbuf)
*/
void mutt_paddstr (int n, const char *s)
......
......@@ -531,11 +531,12 @@ hdr_format_str (char *dest,
{
if (flags & M_FORMAT_FORCESUBJ)
{
snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, NONULL (hdr->env->subject));
mutt_format_s (dest, destlen, prefix, buf2);
mutt_format_s (dest, destlen, "", NONULL (hdr->env->subject));
snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, dest);
mutt_format_s_tree (dest, destlen, prefix, buf2);
}
else
mutt_format_s (dest, destlen, prefix, hdr->tree);
mutt_format_s_tree (dest, destlen, prefix, hdr->tree);
}
else
mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->subject));
......
......@@ -136,7 +136,7 @@ void menu_pad_string (char *s, size_t l)
l = COLS - shift;
/* Let's just pad the string anyway ... */
mutt_format_string (s, INT_MAX, l, l, 0, ' ', s, n);
mutt_format_string (s, INT_MAX, l, l, 0, ' ', s, n, 1);
return;
#if !defined (HAVE_BKGDSET) && !defined (USE_SLANG_CURSES)
......
......@@ -162,8 +162,9 @@ void mutt_expand_fmt (char *, size_t, const char *, const char *);
void mutt_expand_link (char *, const char *, const char *);
void mutt_fix_reply_recipients (ENVELOPE *env);
void mutt_folder_hook (char *);
void mutt_format_string (char *, size_t, int, int, int, char, const char *, size_t);
void mutt_format_string (char *, size_t, int, int, int, char, const char *, size_t, int);
void mutt_format_s (char *, size_t, const char *, const char *);
void mutt_format_s_tree (char *, size_t, const char *, const char *);
void mutt_forward_intro (FILE *fp, HEADER *cur);
void mutt_forward_trailer (FILE *fp);
void mutt_free_alias (ALIAS **);
......
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