From 97dcd377e7c2f884b280e7b1f464f80812a53411 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 6 Feb 2016 11:18:27 +0000 Subject: [PATCH] Turning the cursor off when writing in the status bar, and ensuring it is on when waiting for input. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5610 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 ++ src/nano.c | 12 +++--------- src/text.c | 6 ------ src/winio.c | 3 +++ 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9056ad6c..d7cc89de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ been working for a dozen years. * src/winio.c (statusbar): Update the screen immediately whenever a message has been posted on the status bar. + * src/winio.c (statusbar), src/nano.c (do_input): Turn the cursor off + when writing in the status bar, and on when waiting for input. 2016-02-05 Benno Schulenberg * doc/texinfo/nano.texi: Condense the descriptions of command-key diff --git a/src/nano.c b/src/nano.c index 2cbf7051..164b40d1 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1346,9 +1346,6 @@ RETSIGTYPE do_continue(int signal) /* Restore the terminal to its previous state. */ terminal_init(); - /* Turn the cursor back on for sure. */ - curs_set(1); - /* Redraw the contents of the windows that need it. */ blank_statusbar(); wnoutrefresh(bottomwin); @@ -1407,9 +1404,6 @@ void regenerate_screen(void) /* Restore the terminal to its previous state. */ terminal_init(); - /* Turn the cursor back on for sure. */ - curs_set(1); - /* Do the equivalent of what both mutt and Minimum Profit do: * Reinitialize all the windows based on the new screen * dimensions. */ @@ -1610,6 +1604,9 @@ int do_input(bool allow_funcs) const sc *s; bool have_shortcut; + /* Turn the cursor on when waiting for input. */ + curs_set(1); + /* Read in a character. */ input = get_kbinput(edit); @@ -2534,9 +2531,6 @@ int main(int argc, char **argv) /* Set up the terminal state. */ terminal_init(); - /* Turn the cursor on for sure. */ - curs_set(1); - #ifdef DEBUG fprintf(stderr, "Main: set up windows\n"); #endif diff --git a/src/text.c b/src/text.c index 9dacb9dd..8c6601ae 100644 --- a/src/text.c +++ b/src/text.c @@ -2755,9 +2755,6 @@ const char *do_alt_speller(char *tempfile_name) /* Restore the terminal to its previous state. */ terminal_init(); - /* Turn the cursor back on for sure. */ - curs_set(1); - if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0) { #ifndef NANO_TINY /* Turn the mark back on if it was on before. */ @@ -3300,9 +3297,6 @@ void do_formatter(void) /* Restore the terminal to its previous state. */ terminal_init(); - /* Turn the cursor back on for sure. */ - curs_set(1); - if (!WIFEXITED(format_status) || WEXITSTATUS(format_status) != 0) finalstatus = invocation_error(openfile->syntax->formatter); else { diff --git a/src/winio.c b/src/winio.c index 016c5776..21a4a6c2 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2117,6 +2117,9 @@ void statusbar(const char *msg, ...) return; } + /* Turn the cursor off while fiddling in the statusbar. */ + curs_set(0); + blank_statusbar(); bar = charalloc(mb_cur_max() * (COLS - 3)); -- 2.39.5