let the caller deal with M_FORMAT_ARROWCURSOR, not the callee.
[apps/madmutt.git] / muttlib.c
index f185e12..9c108b7 100644 (file)
--- 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;