commit 37fd348a1de7b2a8cbabc023297e29f9c696daf8
parent 2aac470cb9300797519fe1b294360c45496a5d09
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 7 Apr 2015 10:41:00 +0000
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
Diffstat:
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -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
diff --git a/src/browser.c b/src/browser.c
@@ -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
diff --git a/src/proto.h b/src/proto.h
@@ -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);