#include <ctype.h>
#include <unistd.h>
+#define SW (option(OPTMBOXPANE)?SidebarWidth:0)
+
static char *get_sort_str (char *buf, size_t buflen, int method)
{
snprintf (buf, buflen, "%s%s%s",
if (!StChars)
buf[0] = 0;
- else if (i >= mutt_strlen (StChars))
+ else if (i >= str_len (StChars))
buf[0] = StChars[0];
else
buf[0] = StChars[i];
break;
case 'v':
- snprintf (fmt, sizeof (fmt), "Mutt-ng %%s");
- snprintf (buf, buflen, fmt, MUTT_VERSION);
+ strncpy (buf, mutt_make_version (0), buflen);
break;
case 'V':
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);
}