]> granicus.if.org Git - mutt/commitdiff
Fix pager and index display when non-printable space characters are
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 17 Oct 2000 15:10:51 +0000 (15:10 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 17 Oct 2000 15:10:51 +0000 (15:10 +0000)
encountered.  From EGE.

commands.c
curs_lib.c
hdrline.c
menu.c
protos.h

index 915312eae07a3eec29a7c2d3c950333db1698208..3d1af3d805089f516ba69ee3672a0b75534384e0 100644 (file)
@@ -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)
   {
index 081d64dc62ea7f521dbd5af4228f88c883674e2d..6a9d269cb94a87a201f87ac6f939da21120e7dd1 100644 (file)
@@ -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)
index 989e1c9d0eb367e26491096782b6960fc570e42a..7c9c064fc6cca5dbc08e2508118356b41dced927 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -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));
diff --git a/menu.c b/menu.c
index ee7dfdb492cbf61cfb28a2ee08ffdeb8c8bbb01d..39e4d729139c9f18a471f4d7ec13e11913a7227d 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -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)
index 1b096e926187d430858b2477911a715088f3408c..11a9f16e40434c3ce83cd341f7e36dda3f5cb9ec 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -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 **);