From 6ad3d3d6c007ba3e2d471d5530e04a28f1b25846 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@justemail.net> Date: Mon, 29 May 2017 22:06:59 +0200 Subject: [PATCH] display: show the cursor position also when searching took a while Achieve this by making the suppression flag global, so that we can just reset it instead of making an improper call of do_cursorpos(). This fixes the secondary part of https://savannah.gnu.org/bugs/?51134. --- src/global.c | 3 +++ src/proto.h | 2 ++ src/search.c | 5 ++++- src/text.c | 8 +++----- src/winio.c | 2 -- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/global.c b/src/global.c index ebb7ce15..4f82ead7 100644 --- a/src/global.c +++ b/src/global.c @@ -57,6 +57,9 @@ bool have_palette = FALSE; /* Whether the colors for the current syntax have been initialized. */ #endif +bool suppress_cursorpos = FALSE; + /* Should we skip constant position display for current keystroke? */ + message_type lastmessage = HUSH; /* Messages of type HUSH should not overwrite type MILD nor ALERT. */ diff --git a/src/proto.h b/src/proto.h index 0581762f..7e9af637 100644 --- a/src/proto.h +++ b/src/proto.h @@ -47,6 +47,8 @@ extern int editwincols; extern bool have_palette; #endif +extern bool suppress_cursorpos; + extern message_type lastmessage; extern filestruct *pletion_line; diff --git a/src/search.c b/src/search.c index 4d23134a..1452a1af 100644 --- a/src/search.c +++ b/src/search.c @@ -361,8 +361,11 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region, if (match_len != NULL) *match_len = found_len; - if (feedback > 0) + /* Wipe the "Searching..." message and unset the suppression flag. */ + if (feedback > 0) { blank_statusbar(); + suppress_cursorpos = FALSE; + } return 1; } diff --git a/src/text.c b/src/text.c index 10415d7a..124c5ab7 100644 --- a/src/text.c +++ b/src/text.c @@ -2448,10 +2448,8 @@ void do_justify(bool full_justify) } while (kbinput == KEY_WINCH); #endif - /* If needed, unset the cursor-position suppression flag, so the cursor - * position /will/ be displayed upon a return to the main loop. */ - if (ISSET(CONSTANT_SHOW)) - do_cursorpos(FALSE); + /* Unset the suppression flag after showing the Unjustify message. */ + suppress_cursorpos = FALSE; func = func_from_key(&kbinput); @@ -3568,7 +3566,7 @@ void do_verbatim_input(void) /* Unsuppress cursor-position display or blank the statusbar. */ if (ISSET(CONSTANT_SHOW)) - do_cursorpos(FALSE); + suppress_cursorpos = FALSE; else { blank_statusbar(); wnoutrefresh(bottomwin); diff --git a/src/winio.c b/src/winio.c index e06a8ee1..e2014860 100644 --- a/src/winio.c +++ b/src/winio.c @@ -47,8 +47,6 @@ static bool solitary = FALSE; /* Whether an Esc arrived by itself -- not as leader of a sequence. */ static int statusblank = 0; /* The number of keystrokes left before we blank the statusbar. */ -static bool suppress_cursorpos = FALSE; - /* Should we skip constant position display for one keystroke? */ #ifdef USING_OLD_NCURSES static bool seen_wide = FALSE; /* Whether we've seen a multicolumn character in the current line. */ -- GitLab