Show
Ignore:
Timestamp:
2007-04-11 22:36:24 (21 months ago)
Author:
Michael Elkins <me@…>
Branch:
HEAD
Message:

Pass column value recursively when expanding format strings (bug #2840).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • muttlib.c

    r5098 r5137  
    992992void mutt_FormatString (char *dest,             /* output buffer */ 
    993993                        size_t destlen,         /* output buffer len */ 
     994                        size_t col,             /* starting column (nonzero when called recursively) */ 
    994995                        const char *src,        /* template string */ 
    995996                        format_t *callback,     /* callback for processing */ 
     
    9991000  char prefix[SHORT_STRING], buf[LONG_STRING], *cp, *wptr = dest, ch; 
    10001001  char ifstring[SHORT_STRING], elsestring[SHORT_STRING]; 
    1001   size_t wlen, count, len, col, wid; 
     1002  size_t wlen, count, len, wid; 
    10021003  pid_t pid; 
    10031004  FILE *filter; 
     
    10081009  destlen--; /* save room for the terminal \0 */ 
    10091010  wlen = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0; 
    1010   col = wlen; 
     1011  col += wlen; 
    10111012 
    10121013  if ((flags & M_FORMAT_NOFILTER) == 0) 
     
    10561057        dprint(3, (debugfile, "fmtpipe %2d: %s\n", i++, word->data)); 
    10571058        mutt_buffer_addch(command, '\''); 
    1058         mutt_FormatString(buf, sizeof(buf), word->data, callback, data, 
     1059        mutt_FormatString(buf, sizeof(buf), 0, word->data, callback, data, 
    10591060                          flags | M_FORMAT_NOFILTER); 
    10601061        for (p = buf; p && *p; p++) 
     
    10751076      dprint(3, (debugfile, "fmtpipe > %s\n", command->data)); 
    10761077 
     1078      col -= wlen;      /* reset to passed in value */ 
    10771079      wptr = dest;      /* reset write ptr */ 
    10781080      wlen = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0; 
     
    11011103            if (recycler) 
    11021104            { 
    1103               mutt_FormatString(dest, destlen++, recycler, callback, data, flags); 
     1105              mutt_FormatString(dest, destlen++, col, recycler, callback, data, flags); 
    11041106              FREE(&recycler); 
    11051107            } 
     
    12041206        { 
    12051207          count -= col; /* how many columns left on this line */ 
    1206           mutt_FormatString (buf, sizeof (buf), src, callback, data, flags); 
     1208          mutt_FormatString (buf, sizeof (buf), 0, src, callback, data, flags); 
    12071209          len = mutt_strlen (buf); 
    12081210          wid = mutt_strwidth (buf); 
     
    12541256         
    12551257        /* use callback function to handle this case */ 
    1256         src = callback (buf, sizeof (buf), ch, src, prefix, ifstring, elsestring, data, flags); 
     1258        src = callback (buf, sizeof (buf), col, ch, src, prefix, ifstring, elsestring, data, flags); 
    12571259 
    12581260        if (tolower)