nano

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

commit 4df2f8129537081bd83f816e006b8ee8b98e7cc7
parent 78def852d1ffb84a1f4712a182a11511f80bb3ee
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue,  1 Oct 2019 13:25:03 +0200

tweaks: avoid recomputing a maximum value every time round the loop

Diffstat:
Msrc/global.c | 3++-
Msrc/nano.h | 3---
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/global.c b/src/global.c @@ -432,9 +432,10 @@ int the_code_for(void (*func)(void), int defaultval) size_t shown_entries_for(int menu) { funcstruct *item = allfuncs; + size_t maximum = ((COLS + 40) / 20) * 2; size_t count = 0; - while (count < MAIN_VISIBLE && item != NULL) { + while (count < maximum && item != NULL) { if (item->menus & menu) count++; item = item->next; diff --git a/src/nano.h b/src/nano.h @@ -629,9 +629,6 @@ enum #define WAS_MARKED_FORWARD (1<<5) #endif /* !NANO_TINY */ -/* The maximum number of entries displayed in the main shortcut list. */ -#define MAIN_VISIBLE (((COLS + 40) / 20) * 2) - /* The default number of columns from end of line where wrapping occurs. */ #define COLUMNS_FROM_EOL 8