X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=muttlib.c;h=0340d20d67a4ad9987de509e74056abd0c50238f;hp=b7bba5794b7be53c808f87a03d75f6931ae4b428;hb=079475507f097b263fcd3037c8ee10f4b0dae325;hpb=5088ef227c399f820df601a328ec85afaa732091 diff --git a/muttlib.c b/muttlib.c index b7bba57..0340d20 100644 --- a/muttlib.c +++ b/muttlib.c @@ -929,6 +929,23 @@ void mutt_safe_path (char *s, size_t l, ADDRESS *a) *p = '_'; } +/* counts how many characters in s can be skipped while none of the + * characters of c appears */ +int mutt_skipchars (const char* s, const char* c) { + int ret = 0; + const char* p = s; + while (s && *s) { + register const char* t = c; + while (t && *t) { + if (*t == *s) + return (ret); + t++; + } + ret++; + s++; + } + return (mutt_strlen (p)); +} void mutt_FormatString (char *dest, /* output buffer */ size_t destlen, /* output buffer len */ @@ -1026,10 +1043,10 @@ void mutt_FormatString (char *dest, /* output buffer */ ch = *src++; /* pad char */ /* calculate space left on line. if we've already written more data than will fit on the line, ignore the rest of the line */ - if ( DrawFullLine ) + if ( DrawFullLine || option(OPTSTATUSONTOP)) count = (COLS < destlen ? COLS : destlen); else - count = ((COLS) < destlen ? (COLS) : destlen); + count = ((COLS-SidebarWidth) < destlen ? (COLS - SidebarWidth) : destlen); if (count > col) { count -= col; /* how many columns left on this line */ @@ -1136,9 +1153,15 @@ void mutt_FormatString (char *dest, /* output buffer */ } else { - *wptr++ = *src++; - wlen++; - col++; + unsigned int bar = mutt_skipchars (src, "%\\"); + char* bar2 = safe_malloc (bar+1); + strfcpy (bar2, src, bar+1); + while (bar--) { + *wptr++ = *src++; + wlen++; + } + col += mutt_strwidth (bar2); + FREE(&bar2); } } *wptr = 0;