nano

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

commit 6ad3d3d6c007ba3e2d471d5530e04a28f1b25846
parent ca708855642ab0088b2b53b5b0848e2ed51178cd
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon, 29 May 2017 22:06:59 +0200

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.

Diffstat:
Msrc/global.c | 3+++
Msrc/proto.h | 2++
Msrc/search.c | 5++++-
Msrc/text.c | 8+++-----
Msrc/winio.c | 2--
5 files changed, 12 insertions(+), 8 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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 @@ -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. */