]> granicus.if.org Git - neomutt/commitdiff
Fix mutt_pad_string; from Edmund Grimley Evans. (MAY NEED TO BE
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 13 Feb 2002 09:53:33 +0000 (09:53 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 13 Feb 2002 09:53:33 +0000 (09:53 +0000)
BACKPORTED.)

menu.c

diff --git a/menu.c b/menu.c
index 32df80b194bc0836446f5ef31c2e6682f78d4192..cfa4787028be018d1fe362eb4552a9f5882e9f1c 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -148,30 +148,13 @@ static void menu_make_entry (char *s, int l, MUTTMENU *menu, int i)
     menu->make_entry (s, l, menu, i);
 }
 
-void menu_pad_string (char *s, size_t l)
+void menu_pad_string (char *s, size_t n)
 {
-  size_t n = mutt_strlen (s);
   int shift = option (OPTARROWCURSOR) ? 3 : 0;
-  
-  l--; /* save room for the terminal \0 */
-  if (l > COLS - shift)
-    l = COLS - shift;
-
-  /* Let's just pad the string anyway ... */
-  mutt_format_string (s, INT_MAX, l, l, 0, ' ', s, n, 1);
-  return;
+  int cols = COLS - shift;
 
-#if !defined (HAVE_BKGDSET) && !defined (USE_SLANG_CURSES)
-  /* we have to pad the string with blanks to the end of line */
-  if (n < l)
-  {
-    while (n < l)
-      s[n++] = ' ';
-    s[n] = 0;
-  }
-  else
-#endif
-    s[l] = 0;
+  mutt_format_string (s, n, cols, cols, 0, ' ', s, strlen (s), 1);
+  s[n - 1] = 0;
 }
 
 void menu_redraw_full (MUTTMENU *menu)