X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-ui%2Fstatus.c;h=3462ffa7e762c4089f97051c4720a71a64db28d8;hb=8a2967d883cee12f0de4c0cdf0cd594ea96e622b;hp=b19bf2435a17a4490552d44f99f6d38df625623e;hpb=8476307969a605bea67f6b702b0c1e7a52038bed;p=apps%2Fmadmutt.git diff --git a/lib-ui/status.c b/lib-ui/status.c index b19bf24..3462ffa 100644 --- a/lib-ui/status.c +++ b/lib-ui/status.c @@ -48,14 +48,14 @@ static char *get_sort_str (char *buf, ssize_t buflen, int method) * %V = currently active limit pattern [option] */ static const char *status_format_str (char *buf, ssize_t buflen, char op, const char *src, const char *prefix, - const char *ifstring, - const char *elsestring, - unsigned long data, format_flag flags) + const char *ifstr, + const char *elstr, + anytype data, format_flag flags) { - char fmt[SHORT_STRING], tmp[SHORT_STRING]; + char fmt[STRING], tmp[STRING]; const char *cp, *p; int count, optional = (flags & M_FORMAT_OPTIONAL); - MUTTMENU *menu = (MUTTMENU *) data; + MUTTMENU *menu = data.ptr; *buf = 0; switch (op) { @@ -275,25 +275,23 @@ static const char *status_format_str (char *buf, ssize_t buflen, char op, return (src); default: - snprintf (buf, buflen, "%%%s%c", prefix, op); + *buf = 0; break; } if (optional) - menu_status_line (buf, buflen, menu, ifstring); + menu_status_line (buf, buflen, menu, ifstr); else if (flags & M_FORMAT_OPTIONAL) - menu_status_line (buf, buflen, menu, elsestring); + menu_status_line (buf, buflen, menu, elstr); return (src); } void menu_status_line (char* buf, ssize_t len, MUTTMENU* menu, const char* p) { - /* - * if we have enough space for buffer, format lines to $COLS-$SidebarWidth - * only to not wrap past end of screen - */ - int width = COLS - SW; - mutt_FormatString (buf, (width >= len ? len : (width + 1)), - p, status_format_str, - (unsigned long) menu, 0); + /* + * if we have enough space for buffer, format lines to $COLS-$SidebarWidth + * only to not wrap past end of screen + */ + int width = MIN(COLS - SW + 1, len); + m_strformat(buf, width, p, status_format_str, menu, 0); }