nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit c19f0c732ef060e7e686303bc1f4d434b33d00c6
parent 6ad3700a3dcf180d0c31830f72c32385c7098bdc
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sat, 27 Aug 2016 10:03:34 +0200

tweaks: simplify the determination of the number of shown help items

Diffstat:
Msrc/winio.c | 28++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -1476,17 +1476,11 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts) return 0; } - /* Get the shortcut lists' length. */ - if (currmenu == MMAIN) - currslen = MAIN_VISIBLE; - else { - currslen = length_of_list(currmenu); + /* Determine how many shortcuts are being shown. */ + currslen = length_of_list(currmenu); - /* We don't show any more shortcuts than the main list - * does. */ - if (currslen > MAIN_VISIBLE) - currslen = MAIN_VISIBLE; - } + if (currslen > MAIN_VISIBLE) + currslen = MAIN_VISIBLE; /* Calculate the width of all of the shortcuts in the list * except for the last two, which are longer by (COLS % i) @@ -2047,17 +2041,11 @@ void bottombars(int menu) if (ISSET(NO_HELP) || LINES < 5) return; - if (menu == MMAIN) { - slen = MAIN_VISIBLE; - - assert(slen <= length_of_list(menu)); - } else { - slen = length_of_list(menu); + /* Determine how many shortcuts there are to show. */ + slen = length_of_list(menu); - /* Don't show any more shortcuts than the main list does. */ - if (slen > MAIN_VISIBLE) - slen = MAIN_VISIBLE; - } + if (slen > MAIN_VISIBLE) + slen = MAIN_VISIBLE; /* Compute the width of each keyname-plus-explanation pair. */ colwidth = COLS / ((slen / 2) + (slen % 2));