let m_strformat accept NULL formats.
[apps/madmutt.git] / lib-ui / status.c
index e3dd6e1..3462ffa 100644 (file)
@@ -288,11 +288,10 @@ static const char *status_format_str (char *buf, ssize_t buflen, char op,
 }
 
 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;
-  m_strformat(buf, (width >= len ? len : (width + 1)), p, status_format_str,
-              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);
 }