commit 29276d1d3a8ff5322d6a151d69c14e33934ac577
parent 13b839734f509de48627c2f2a76bfcc6ddd2dde3
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 26 Nov 2020 17:12:09 +0100
help: allow the penultimate item extra space when the number is uneven
This avoids unnecessarily truncating the last help item on the
very bottom row when there is still plenty of room.
This fixes https://savannah.gnu.org/bugs/?59550.
Bug has been visible since at least version 2.5.1.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/winio.c b/src/winio.c
@@ -2216,6 +2216,8 @@ void bottombars(int menu)
/* Display the first number of shortcuts in the given menu that
* have a key combination assigned to them. */
for (f = allfuncs, index = 0; f != NULL && index < number; f = f->next) {
+ size_t thiswidth = itemwidth;
+
if ((f->menus & menu) == 0)
continue;
@@ -2226,7 +2228,11 @@ void bottombars(int menu)
wmove(bottomwin, 1 + index % 2, (index / 2) * itemwidth);
- post_one_key(s->keystr, _(f->desc), itemwidth +
+ /* When the number is uneven, the penultimate item can be extra wide. */
+ if ((number % 2) == 1 && (index + 2 == number))
+ thiswidth += itemwidth;
+
+ post_one_key(s->keystr, _(f->desc), thiswidth +
((index < number - 2) ? 0 : COLS % itemwidth));
index++;
}