nano

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

commit 6a7a0c8f50e1596072951dbfc02065e228630f30
parent f5bc261944722d8b0938ace56287d8910895f40d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon, 20 Nov 2023 16:05:42 +0100

display: show the help lines down to the tiniest possible terminal size

That is: compute the minimum needed terminal height more accurately.

Diffstat:
Msrc/nano.c | 7++++---
Msrc/winio.c | 2+-
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -420,8 +420,9 @@ void window_init(void) midwin = newwin(editwinrows, COLS, 0, 0); footwin = newwin(1, COLS, LINES - 1, 0); } else { - int toprows = ((ISSET(EMPTY_LINE) && LINES > 6) ? 2 : 1); - int bottomrows = ((ISSET(NO_HELP) || LINES < 6) ? 1 : 3); + int minimum = (ISSET(ZERO) ? 3 : ISSET(MINIBAR) ? 4 : 5); + int toprows = ((ISSET(EMPTY_LINE) && LINES > minimum) ? 2 : 1); + int bottomrows = ((ISSET(NO_HELP) || LINES < minimum) ? 1 : 3); if (ISSET(MINIBAR) || ISSET(ZERO)) toprows = 0; @@ -1077,7 +1078,7 @@ void toggle_this(int flag) draw_all_subwindows(); return; case NO_HELP: - if (LINES < 6) { + if (LINES < (ISSET(ZERO) ? 3 : ISSET(MINIBAR) ? 4 : 5)) { statusline(AHEM, _("Too tiny")); TOGGLE(flag); return; diff --git a/src/winio.c b/src/winio.c @@ -2431,7 +2431,7 @@ void bottombars(int menu) /* Set the global variable to the given menu. */ currmenu = menu; - if (ISSET(NO_HELP) || LINES < 6) + if (ISSET(NO_HELP) || LINES < (ISSET(ZERO) ? 3 : ISSET(MINIBAR) ? 4 : 5)) return; /* Determine how many shortcuts must be shown. */