]> granicus.if.org Git - neomutt/commitdiff
fix the padding expando '%>'
authorRichard Russon <rich@flatcap.org>
Thu, 29 Jun 2017 12:28:58 +0000 (13:28 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 2 Jul 2017 20:52:08 +0000 (21:52 +0100)
Debian BTS 866366

The non-greedy '%>' has been broken since the introduction of the
nested-if patch.

The second command should create a line of dots ending in a ']'

    set index_format="%?M?collapsed%|.]&expanded?
    set index_format="%?M?collapsed%>.]&expanded?

muttlib.c

index 40608929f122782b7ac10ae6f19cb75305ef4b98..8def1da066f4a3ff74e51916ee03067fbeecf6f3 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -1528,6 +1528,15 @@ void mutt_FormatString(char *dest,     /* output buffer */
         lrbalance = 1;
         while ((lrbalance > 0) && (count < sizeof(ifstring)) && *src)
         {
+          if ((src[0] == '%') && (src[1] == '>'))
+          {
+            /* This is a padding expando; copy two chars and carry on */
+            *cp++ = *src++;
+            *cp++ = *src++;
+            count += 2;
+            continue;
+          }
+
           if (*src == '\\')
           {
             src++;
@@ -1557,6 +1566,15 @@ void mutt_FormatString(char *dest,     /* output buffer */
         count = 0;
         while ((lrbalance > 0) && (count < sizeof(elsestring)) && *src)
         {
+          if ((src[0] == '%') && (src[1] == '>'))
+          {
+            /* This is a padding expando; copy two chars and carry on */
+            *cp++ = *src++;
+            *cp++ = *src++;
+            count += 2;
+            continue;
+          }
+
           if (*src == '\\')
           {
             src++;