nano

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

commit 108fe330d330389343e2f56b28dbc47ddc4713cd
parent 38b74e699329dfad4f0c2c6420f7ff5361fcadd3
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon, 28 Mar 2016 19:00:19 +0000

Providing feedback when searching takes longer than roughly half a second.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5767 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 2++
Msrc/search.c | 10++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -2,6 +2,8 @@ * src/winio.c (statusbar): Don't bother putting back the cursor in the edit window, as it is off anyway, and will be placed back in the main loop. This prevents a segfault when trying to open a directory. + * src/search.c (findnextstr): Provide feedback when searching takes + longer than roughly half a second (on average). 2016-03-23 Benno Schulenberg <bensberg@justemail.net> * src/search.c (findnextstr): Prevent the internal spell checker from diff --git a/src/search.c b/src/search.c @@ -260,6 +260,8 @@ bool findnextstr( { size_t found_len; /* The length of the match we find. */ + int feedback = 0; + /* When bigger than zero, show and wipe the "Searching..." message. */ ssize_t current_y_find = openfile->current_y; filestruct *fileptr = openfile->current; const char *rev_start = fileptr->data, *found = NULL; @@ -291,6 +293,9 @@ bool findnextstr( statusbar(_("Cancelled")); return FALSE; } + + if (++feedback > 0) + statusbar(_("Searching...")); } /* Search for the needle in the current line. */ @@ -366,6 +371,8 @@ bool findnextstr( current_y_find = 0; } statusbar(_("Search Wrapped")); + /* Delay the "Searching..." message for at least two seconds. */ + feedback = -2; } /* If we've reached the original starting line, take note. */ @@ -392,6 +399,9 @@ bool findnextstr( if (match_len != NULL) *match_len = found_len; + if (feedback > 0) + blank_statusbar(); + return TRUE; }