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.
master
Benno Schulenberg 2021-05-10 12:17:35 +02:00
parent 36ffb5f0ac
commit 2cf28f9db7
1 changed files with 10 additions and 1 deletions

View File

@ -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);