1
1

tweaks: move a fragment of common code into the appropriate function

Этот коммит содержится в:
Benno Schulenberg 2019-09-27 18:49:39 +02:00
родитель 40f6dbc34e
Коммит cd00d0975e
2 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -438,6 +438,9 @@ size_t length_of_list(int menu)
if ((f->menus & menu) && first_sc_for(menu, f->func) != NULL) if ((f->menus & menu) && first_sc_for(menu, f->func) != NULL)
i++; i++;
if (i > MAIN_VISIBLE)
return MAIN_VISIBLE;
else
return i; return i;
} }

Просмотреть файл

@ -1695,10 +1695,8 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
return 0; return 0;
} }
/* Determine how many shortcuts will be shown. */ /* Determine how many shortcuts are being shown. */
number = length_of_list(currmenu); number = length_of_list(currmenu);
if (number > MAIN_VISIBLE)
number = MAIN_VISIBLE;
/* Calculate the width of each non-rightmost shortcut item; /* Calculate the width of each non-rightmost shortcut item;
* the rightmost ones will "absorb" any remaining slack. */ * the rightmost ones will "absorb" any remaining slack. */
@ -2294,12 +2292,9 @@ void bottombars(int menu)
if (ISSET(NO_HELP) || LINES < 5) if (ISSET(NO_HELP) || LINES < 5)
return; return;
/* Determine how many shortcuts there are to show. */ /* Determine how many shortcuts must be shown. */
number = length_of_list(menu); number = length_of_list(menu);
if (number > MAIN_VISIBLE)
number = MAIN_VISIBLE;
/* Compute the width of each keyname-plus-explanation pair. */ /* Compute the width of each keyname-plus-explanation pair. */
itemwidth = COLS / ((number / 2) + (number % 2)); itemwidth = COLS / ((number / 2) + (number % 2));