nano

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

commit 2cf28f9db7566d2415d2679d0d4c3ffb8bee5411
parent 36ffb5f0ac6e8eeaa8ab085445d572aa6d87b0ad
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon, 10 May 2021 12:17:35 +0200

statusbar: suppress the cursor when the terminal has just one row

When showing a message on the status bar, the cursor should be off.

This fixes https://savannah.gnu.org/bugs/?60510.

Bug existed since version 2.7.0, since nano allows very flat terminals.

Diffstat:
Msrc/winio.c | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/winio.c b/src/winio.c @@ -182,10 +182,14 @@ void read_keys_from(WINDOW *win) bool timed = FALSE; #endif + /* On a one-row terminal, overwrite an unimportant message. */ + if (LINES == 1 && currmenu == MMAIN && lastmessage == HUSH) + edit_refresh(); + /* Before reading the first keycode, display any pending screen updates. */ doupdate(); - if (reveal_cursor && !hide_cursor) + if (reveal_cursor && !hide_cursor && (LINES > 1 || lastmessage <= HUSH)) curs_set(1); #ifndef NANO_TINY @@ -2245,6 +2249,11 @@ void statusline(message_type importance, const char *msg, ...) if (importance < lastmessage && lastmessage > NOTICE) return; + /* On a one-row terminal, ensure that any changes in the edit window are + * written out first, to prevent them from overwriting the message. */ + if (LINES == 1 && importance < INFO) + wnoutrefresh(edit); + /* Construct the message out of all the arguments. */ compound = nmalloc(MAXCHARLEN * COLS + 1); va_start(ap, msg);