From: Thomas Roessler Date: Wed, 13 Feb 2002 09:53:33 +0000 (+0000) Subject: Fix mutt_pad_string; from Edmund Grimley Evans. (MAY NEED TO BE X-Git-Tag: mutt-1-5-1-rel~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23dcad44863952dfef331fef73dd61bb7b127617;p=mutt Fix mutt_pad_string; from Edmund Grimley Evans. (MAY NEED TO BE BACKPORTED.) --- diff --git a/menu.c b/menu.c index 32df80b1..cfa47870 100644 --- 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)