mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +03:00
tweaks: simplify the determination of the number of shown help items
This commit is contained in:
parent
6ad3700a3d
commit
c19f0c732e
28
src/winio.c
28
src/winio.c
@ -1476,17 +1476,11 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the shortcut lists' length. */
|
/* Determine how many shortcuts are being shown. */
|
||||||
if (currmenu == MMAIN)
|
currslen = length_of_list(currmenu);
|
||||||
currslen = MAIN_VISIBLE;
|
|
||||||
else {
|
|
||||||
currslen = length_of_list(currmenu);
|
|
||||||
|
|
||||||
/* We don't show any more shortcuts than the main list
|
if (currslen > MAIN_VISIBLE)
|
||||||
* does. */
|
currslen = MAIN_VISIBLE;
|
||||||
if (currslen > MAIN_VISIBLE)
|
|
||||||
currslen = MAIN_VISIBLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate the width of all of the shortcuts in the list
|
/* Calculate the width of all of the shortcuts in the list
|
||||||
* except for the last two, which are longer by (COLS % i)
|
* except for the last two, which are longer by (COLS % i)
|
||||||
@ -2047,18 +2041,12 @@ void bottombars(int menu)
|
|||||||
if (ISSET(NO_HELP) || LINES < 5)
|
if (ISSET(NO_HELP) || LINES < 5)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (menu == MMAIN) {
|
/* Determine how many shortcuts there are to show. */
|
||||||
|
slen = length_of_list(menu);
|
||||||
|
|
||||||
|
if (slen > MAIN_VISIBLE)
|
||||||
slen = MAIN_VISIBLE;
|
slen = MAIN_VISIBLE;
|
||||||
|
|
||||||
assert(slen <= length_of_list(menu));
|
|
||||||
} else {
|
|
||||||
slen = length_of_list(menu);
|
|
||||||
|
|
||||||
/* Don't show any more shortcuts than the main list does. */
|
|
||||||
if (slen > MAIN_VISIBLE)
|
|
||||||
slen = MAIN_VISIBLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compute the width of each keyname-plus-explanation pair. */
|
/* Compute the width of each keyname-plus-explanation pair. */
|
||||||
colwidth = COLS / ((slen / 2) + (slen % 2));
|
colwidth = COLS / ((slen / 2) + (slen % 2));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user