Eliding a miniscule function, and renaming a variable for clarity.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5180 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-04-07 10:41:00 +00:00
parent 2aac470cb9
commit 37fd348a1d
3 changed files with 8 additions and 14 deletions

View File

@ -5,6 +5,8 @@
(there are no toggles here) and tweak some others.
* src/search.c (do_search, do_research): Use the same variable as
in the surrounding code, for consistency.
* src/browser.c (findnextfile_wrap_reset): Elide this function,
and rename 'search_last_file' to 'came_full_circle'.
2015-04-05 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Expand on nano's features, condense the

View File

@ -41,8 +41,8 @@ static int longest = 0;
static size_t selected = 0;
/* The currently selected filename in the list. This variable
* is zero-based. */
static bool search_last_file = FALSE;
/* Have we gone past the last file while searching? */
static bool came_full_circle = FALSE;
/* Have we reached the starting file again while searching? */
/* Our main file browser function. path is the tilde-expanded path we
* start browsing from. */
@ -787,7 +787,7 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
if (found != NULL && (!no_sameline || currselected != begin))
break;
if (search_last_file) {
if (came_full_circle) {
/* We've finished processing the filenames, so get out. */
not_found_msg(needle);
return FALSE;
@ -804,7 +804,7 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
if (currselected == begin)
/* We've reached the original starting file. */
search_last_file = TRUE;
came_full_circle = TRUE;
filetail = tail(filelist[currselected]);
@ -817,13 +817,6 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
return TRUE;
}
/* Clear the flag indicating that a search reached the last file in the
* list. We need to do this just before a new search. */
void findnextfile_wrap_reset(void)
{
search_last_file = FALSE;
}
/* Abort the current filename search. Clean up by setting the current
* shortcut list to the browser shortcut list, and displaying it. */
void filesearch_abort(void)
@ -861,7 +854,7 @@ void do_filesearch(void)
update_history(&search_history, answer);
#endif
findnextfile_wrap_reset();
came_full_circle = FALSE;
didfind = findnextfile(FALSE, begin, answer);
/* Check to see if there's only one occurrence of the string and
@ -887,7 +880,7 @@ void do_fileresearch(void)
search_init_globals();
if (last_search[0] != '\0') {
findnextfile_wrap_reset();
came_full_circle = FALSE;
didfind = findnextfile(FALSE, begin, last_search);
/* Check to see if there's only one occurrence of the string and

View File

@ -152,7 +152,6 @@ void browser_refresh(void);
bool browser_select_filename(const char *needle);
int filesearch_init(void);
bool findnextfile(bool no_sameline, size_t begin, const char *needle);
void findnextfile_wrap_reset(void);
void filesearch_abort(void);
void do_filesearch(void);
void do_fileresearch(void);