X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=status.c;h=f95eb326f16dbfc1d5ae6eabeb6890700288ccd5;hp=212b007ba6f7eeee4b2d06dd226cdee22353ef82;hb=b3cb6ed8d36c550a2e589910ce51bbc8352ff57c;hpb=364bf52ada05bf7d7158dba9d2391f63b71258f6 diff --git a/status.c b/status.c index 212b007..f95eb32 100644 --- a/status.c +++ b/status.c @@ -11,6 +11,8 @@ # include "config.h" #endif +#include + #include "mutt.h" #include "mutt_menu.h" #include "mutt_curses.h" @@ -27,6 +29,8 @@ #include #include +#define SW (option(OPTMBOXPANE)?SidebarWidth:0) + static char *get_sort_str (char *buf, size_t buflen, int method) { snprintf (buf, buflen, "%s%s%s", @@ -60,7 +64,8 @@ static const char *status_format_str (char *buf, size_t buflen, char op, const char *elsestring, unsigned long data, format_flag flags) { - char fmt[SHORT_STRING], tmp[SHORT_STRING], *cp, *p; + char fmt[SHORT_STRING], tmp[SHORT_STRING]; + const char *cp, *p; int count, optional = (flags & M_FORMAT_OPTIONAL); MUTTMENU *menu = (MUTTMENU *) data; @@ -309,9 +314,13 @@ static const char *status_format_str (char *buf, size_t buflen, char op, return (src); } -void menu_status_line (char *buf, size_t buflen, MUTTMENU * menu, - const char *p) -{ - mutt_FormatString (buf, buflen, p, status_format_str, (unsigned long) menu, - 0); +void menu_status_line (char* buf, size_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); }