Commit 727c244a authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in findnextfile(), simplify the uses of tail()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3696 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 10 additions and 6 deletions
+10 -6
...@@ -19,6 +19,8 @@ CVS code - ...@@ -19,6 +19,8 @@ CVS code -
truncated, and where file sizes could be too long. (DLR) truncated, and where file sizes could be too long. (DLR)
- For the ".." entry, display "(parent dir)" instead of "(dir)", - For the ".." entry, display "(parent dir)" instead of "(dir)",
as Pico does. (DLR) as Pico does. (DLR)
findnextfile()
- Simplify the uses of tail(). (DLR)
- doc/syntax/c.nanorc: - doc/syntax/c.nanorc:
- Since .i and .ii are preprocessed C and C++ output, colorize - Since .i and .ii are preprocessed C and C++ output, colorize
them here. (Mike Frysinger) them here. (Mike Frysinger)
......
...@@ -742,17 +742,17 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle) ...@@ -742,17 +742,17 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
size_t currselected = selected; size_t currselected = selected;
/* The location in the current file list of the match we /* The location in the current file list of the match we
* find. */ * find. */
const char *rev_start = tail(filelist[currselected]), *found = NULL; const char *filetail = tail(filelist[currselected]);
const char *rev_start = filetail, *found = NULL;
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) if (ISSET(BACKWARDS_SEARCH))
rev_start += strlen(tail(filelist[currselected])); rev_start += strlen(rev_start);
#endif #endif
/* Look for needle in the current filename we're searching. */ /* Look for needle in the current filename we're searching. */
while (TRUE) { while (TRUE) {
found = strstrwrapper(tail(filelist[currselected]), needle, found = strstrwrapper(filetail, needle, rev_start);
rev_start);
/* We've found a potential match. If we're not allowed to find /* We've found a potential match. If we're not allowed to find
* a match on the same filename we started on and this potential * a match on the same filename we started on and this potential
...@@ -792,10 +792,12 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle) ...@@ -792,10 +792,12 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
if (currselected == begin) if (currselected == begin)
search_last_file = TRUE; search_last_file = TRUE;
rev_start = tail(filelist[currselected]); filetail = tail(filelist[currselected]);
rev_start = filetail;
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) if (ISSET(BACKWARDS_SEARCH))
rev_start += strlen(tail(filelist[currselected])); rev_start += strlen(rev_start);
#endif #endif
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment