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
master
Benno Schulenberg 2016-03-28 19:00:19 +00:00
parent 38b74e6993
commit 108fe330d3
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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;
}