tweaks: don't burden all menus with something meant for the WriteOut menu

The first_sc_for() function is somewhat costly, so avoid calling it
when it is not necessary.

Most menus have either so many entries that unbinding some keys does
not reduce the number of shown entries, or they have so few entries
that each entry already has space enough and will not profit from
having more room available.  But the WriteOut menu is an edge case.
Most translators don't use --tempfile and translate the key tags for
the WriteOut menu making use of all 17 positions that are available
for each of them.  This makes that when --tempfile is used, some of
those tags get truncated.  This is not so bad, because --tempfile is
normally not used.  But when it isn't used (when the discardbuffer
function isn't bound), the WriteOut menu should make full use of the
available width to avoid truncating any translated tags.
master
Benno Schulenberg 2019-09-29 13:00:27 +02:00
parent e9d6ceab0b
commit b3ace4d8f6
1 changed files with 5 additions and 1 deletions

View File

@ -435,11 +435,15 @@ size_t shown_entries_for(int menu)
size_t count = 0; size_t count = 0;
while (count < MAIN_VISIBLE && item != NULL) { while (count < MAIN_VISIBLE && item != NULL) {
if ((item->menus & menu) && first_sc_for(menu, item->func) != NULL) if (item->menus & menu)
count++; count++;
item = item->next; item = item->next;
} }
/* When --tempfile is not used, widen the grid of the WriteOut menu. */
if (menu == MWRITEFILE && first_sc_for(menu, discard_buffer) == NULL)
count--;
return count; return count;
} }