X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=muttlib.c;h=711b3d8ed8158cb3577fded2d59e48a4f7548800;hp=22d4c76a89b661917ab94277be811b223533efaf;hb=31edbe030ac69952aa535730427246b5e9a1603c;hpb=16ff93bd19515d67ea15468b4adb35395970a559 diff --git a/muttlib.c b/muttlib.c index 22d4c76..711b3d8 100644 --- a/muttlib.c +++ b/muttlib.c @@ -456,6 +456,13 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) } break; + case '^': + { + strfcpy (p, NONULL(CurrentFolder), sizeof (p)); + tail = s + 1; + } + break; + default: { *p = '\0'; @@ -929,6 +936,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 +1050,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-SidebarWidth) < destlen ? COLS - SidebarWidth : destlen); + count = ((COLS-SidebarWidth) < destlen ? (COLS - SidebarWidth) : destlen); if (count > col) { count -= col; /* how many columns left on this line */ @@ -1042,8 +1066,10 @@ void mutt_FormatString (char *dest, /* output buffer */ wptr += count; col += count; } - if (len + wlen > destlen) + if (wid + wlen > destlen) len = destlen - wlen; + else + len = wid; memcpy (wptr, buf, len); wptr += len; wlen += len; @@ -1134,9 +1160,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; @@ -1286,8 +1318,10 @@ void state_prefix_putc (char c, STATE *s) while (regexec ((regex_t *) QuoteRegexp.rx, &Quotebuf[offset], 1, pmatch, 0) == 0) offset += pmatch->rm_eo; - if (!option (OPTQUOTEEMPTY) && Quotebuf[0] == '\n') - strcpy (buf, Quotebuf); + if (!option (OPTQUOTEEMPTY) && Quotebuf[offset] == '\n') { + buf[0] = '\n'; + buf[1] = '\0'; + } else if (option (OPTQUOTEQUOTED) && offset) { for (i = 0; i < offset; i++)