rework m_strformat so that it takes the cols number to use in case of
[apps/madmutt.git] / compose.c
index 52907b6..7e74f61 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -113,9 +113,7 @@ static struct mapping_t ComposeNewsHelp[] = {
 
 
 static void snd_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) {
-  int w = MIN(COLS-SW, blen);
-
-  m_strformat(b, w, AttachFormat, mutt_attach_fmt,
+  m_strformat(b, blen, COLS - SW, AttachFormat, mutt_attach_fmt,
               ((ATTACHPTR **)menu->data)[num],
               M_FORMAT_STAT_FILE | (option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0));
 }
@@ -450,10 +448,8 @@ static const char *compose_format_str (char *buf, ssize_t buflen, char op,
     break;
   }
 
-  if (optional)
-    compose_status_line (buf, buflen, menu, ifstr);
-  else if (flags & M_FORMAT_OPTIONAL)
-    compose_status_line (buf, buflen, menu, elstr);
+  if (flags & M_FORMAT_OPTIONAL)
+    compose_status_line(buf, buflen, menu, optional ? ifstr : elstr);
 
   return (src);
 }
@@ -461,8 +457,7 @@ static const char *compose_format_str (char *buf, ssize_t buflen, char op,
 static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu,
                                  const char *p)
 {
-    int w = MIN(COLS - SW, buflen);
-    m_strformat(buf, w, p, compose_format_str, menu, 0);
+    m_strformat(buf, buflen, COLS - SW, p, compose_format_str, menu, 0);
 }
 
 /* return values: