From 9c9de85afb15f2bf2e6b031dced1d12af922856c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 22 Nov 2021 12:03:28 +0100 Subject: [PATCH] tweaks: elide a variable that is confusing and has just one use case --- src/global.c | 2 -- src/help.c | 1 - src/nano.c | 1 - src/prototypes.h | 1 - src/search.c | 2 -- src/winio.c | 3 ++- 6 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/global.c b/src/global.c index a921cb92..db300d0a 100644 --- a/src/global.c +++ b/src/global.c @@ -80,8 +80,6 @@ linestruct *pletion_line = NULL; bool also_the_last = FALSE; /* Whether indenting/commenting should include the last line of * the marked region. */ -bool hide_cursor = FALSE; - /* Whether to suppress the cursor when highlighting a search match. */ char *answer = NULL; /* The answer string used by the status-bar prompt. */ diff --git a/src/help.c b/src/help.c index 3c54f0bb..cd7293a7 100644 --- a/src/help.c +++ b/src/help.c @@ -469,7 +469,6 @@ void show_help(void) #ifndef NANO_TINY spotlighted = FALSE; - hide_cursor = FALSE; if (bracketed_paste || kbinput == BRACKETED_PASTE_MARKER) { beep(); diff --git a/src/nano.c b/src/nano.c index 11e7a547..6758b196 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1531,7 +1531,6 @@ void process_a_keystroke(void) input = get_kbinput(edit, VISIBLE); lastmessage = VACUUM; - hide_cursor = FALSE; #ifndef NANO_TINY if (input == KEY_WINCH) diff --git a/src/prototypes.h b/src/prototypes.h index 705bdca6..c6fb9333 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -53,7 +53,6 @@ extern message_type lastmessage; extern linestruct *pletion_line; extern bool also_the_last; -extern bool hide_cursor; extern char *answer; diff --git a/src/search.c b/src/search.c index 3408bfdf..04069db8 100644 --- a/src/search.c +++ b/src/search.c @@ -327,8 +327,6 @@ int findnextstr(const char *needle, bool whole_word_only, int modus, spotlighted = TRUE; light_from_col = xplustabs(); light_to_col = wideness(line->data, found_x + found_len); - if (!ISSET(SHOW_CURSOR)) - hide_cursor = TRUE; edit_refresh(); } #endif diff --git a/src/winio.c b/src/winio.c index 9c6fb5cc..b7653530 100644 --- a/src/winio.c +++ b/src/winio.c @@ -189,7 +189,8 @@ void read_keys_from(WINDOW *win) /* Before reading the first keycode, display any pending screen updates. */ doupdate(); - if (reveal_cursor && !hide_cursor && (LINES > 1 || lastmessage <= HUSH)) + if (reveal_cursor && (!spotlighted || ISSET(SHOW_CURSOR || currmenu == MSPELL)) && + (LINES > 1 || lastmessage <= HUSH)) curs_set(1); #ifndef NANO_TINY