From: Benno Schulenberg Date: Mon, 28 Mar 2016 19:00:19 +0000 (+0000) Subject: Providing feedback when searching takes longer than roughly half a second. X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=108fe330d330389343e2f56b28dbc47ddc4713cd;p=nano.git 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 --- diff --git a/ChangeLog b/ChangeLog index 29e02dcc..079c1312 100644 --- 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 * src/search.c (findnextstr): Prevent the internal spell checker from diff --git a/src/search.c b/src/search.c index 6a43f046..c0afcc01 100644 --- 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; }