From 36ffb5f0ac6e8eeaa8ab085445d572aa6d87b0ad Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 9 May 2021 19:11:49 +0200 Subject: [PATCH] statusbar: suppress --constantshow when the terminal has just one row When there is just one row, the text to be edited needs to be shown there, not some meta information about the cursor position. This fixes https://savannah.gnu.org/bugs/?60563. Bug existed since version 2.7.0, since nano allows very flat terminals. --- src/nano.c | 3 ++- src/winio.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nano.c b/src/nano.c index 03b77d06..697e4d14 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2507,7 +2507,8 @@ int main(int argc, char **argv) #endif /* Update the displayed current cursor position only when there * is no message and no keys are waiting in the input buffer. */ - if (ISSET(CONSTANT_SHOW) && lastmessage == VACUUM && get_key_buffer_len() == 0) + if (ISSET(CONSTANT_SHOW) && lastmessage == VACUUM && LINES > 1 && + get_key_buffer_len() == 0) report_cursor_position(); as_an_at = TRUE; diff --git a/src/winio.c b/src/winio.c index 9f811cec..b6b11ae5 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1683,7 +1683,7 @@ void check_statusblank(void) statusblank--; /* When editing and 'constantshow' is active, skip the blanking. */ - if (currmenu == MMAIN && ISSET(CONSTANT_SHOW)) + if (currmenu == MMAIN && ISSET(CONSTANT_SHOW) && LINES > 1) return; if (statusblank == 0)