Saving the settings of the global case-sens, direction, and regexp flags,

and restoring them on exit.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5210 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-04-21 17:27:33 +00:00
parent e68759bf12
commit 6bdcc8faa9
2 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2015-04-21 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (findnextfile): Save the settings of the global
case-sens, direction, and regexp flags, and restore them on exit.
And do this not in do_filesearch() but in findnextfile(), so that
it will also work for do_fileresearch().
2015-04-20 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (need_horizontal_update, need_vertical_update): Fuse
two identical functions into one: need_screen_update().

View File

@ -755,6 +755,16 @@ void findnextfile(const char *needle)
const char *filetail = tail(filelist[looking_at]);
/* The filename we display, minus the path. */
const char *rev_start = filetail, *found = NULL;
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
/* Save the settings of all flags. */
memcpy(stash, flags, sizeof(flags));
/* Search forward, case insensitive and without regexes. */
UNSET(BACKWARDS_SEARCH);
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
/* Step through each filename in the list until a match is found or
* we've come back to the point where we started. */
@ -797,6 +807,9 @@ void findnextfile(const char *needle)
rev_start = filetail;
}
/* Restore the settings of all flags. */
memcpy(flags, stash, sizeof(flags));
/* Select the one we've found. */
selected = looking_at;
}
@ -804,10 +817,6 @@ void findnextfile(const char *needle)
/* Search for a filename. */
void do_filesearch(void)
{
UNSET(CASE_SENSITIVE);
UNSET(USE_REGEXP);
UNSET(BACKWARDS_SEARCH);
if (filesearch_init() != 0) {
/* Cancelled, or a blank search string, or done something. */
bottombars(MBROWSER);