Removing an unfitting comment and tweaking some others.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5178 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-04-07 08:23:52 +00:00
parent 5d0b267aaa
commit 25ce5f6759
2 changed files with 13 additions and 21 deletions

View File

@ -1,6 +1,8 @@
2015-04-07 Benno Schulenberg <bensberg@justemail.net> 2015-04-07 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_fileresearch): Don't search for the empty string * src/browser.c (do_fileresearch): Don't search for the empty string
when nothing was sought yet (when historylog is set). when nothing was sought yet (when historylog is set).
* src/browser.c (filesearch_init): Remove an unfitting comment
(there are no toggles here) and tweak some others.
2015-04-05 Benno Schulenberg <bensberg@justemail.net> 2015-04-05 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Expand on nano's features, condense the * doc/texinfo/nano.texi: Expand on nano's features, condense the

View File

@ -52,8 +52,7 @@ char *do_browser(char *path, DIR *dir)
int kbinput; int kbinput;
bool old_const_update = ISSET(CONST_UPDATE); bool old_const_update = ISSET(CONST_UPDATE);
char *prev_dir = NULL; char *prev_dir = NULL;
/* The directory we were in, if any, before backing up via /* The directory we were in before backing up to "..". */
* browsing to "..". */
char *ans = NULL; char *ans = NULL;
/* The last answer the user typed at the statusbar prompt. */ /* The last answer the user typed at the statusbar prompt. */
size_t old_selected; size_t old_selected;
@ -137,19 +136,16 @@ char *do_browser(char *path, DIR *dir)
width) + (mouse_x / (longest + 2)); width) + (mouse_x / (longest + 2));
/* If they clicked beyond the end of a row, /* If they clicked beyond the end of a row,
* select the filename at the end of that * select the last filename in that row. */
* row. */
if (mouse_x > width * (longest + 2)) if (mouse_x > width * (longest + 2))
selected--; selected--;
/* If we're off the screen, select the last /* If we're off the screen, select the last filename. */
* filename. */
if (selected > filelist_len - 1) if (selected > filelist_len - 1)
selected = filelist_len - 1; selected = filelist_len - 1;
/* If we selected the same filename as last /* If we selected the same filename as last time,
* time, put back the Enter key so that it's * put back the Enter key so that it's read in. */
* read in. */
if (old_selected == selected) if (old_selected == selected)
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE); unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
} }
@ -728,19 +724,13 @@ int filesearch_init(void)
if (backupstring == NULL) if (backupstring == NULL)
backupstring = mallocstrcpy(NULL, ""); backupstring = mallocstrcpy(NULL, "");
/* We display the search prompt below. If the user types a partial
* search string and then Replace or a toggle, we will return to
* do_search() or do_replace() and be called again. In that case,
* we should put the same search string back up. */
search_init_globals(); search_init_globals();
if (last_search[0] != '\0') { if (last_search[0] != '\0') {
char *disp = display_string(last_search, 0, COLS / 3, FALSE); char *disp = display_string(last_search, 0, COLS / 3, FALSE);
buf = charalloc(strlen(disp) + 7); buf = charalloc(strlen(disp) + 7);
/* We use (COLS / 3) here because we need to see more on the /* We use (COLS / 3) here because we need to see more on the line. */
* line. */
sprintf(buf, " [%s%s]", disp, sprintf(buf, " [%s%s]", disp,
(strlenpt(last_search) > COLS / 3) ? "..." : ""); (strlenpt(last_search) > COLS / 3) ? "..." : "");
free(disp); free(disp);
@ -791,14 +781,14 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
while (TRUE) { while (TRUE) {
found = strstrwrapper(filetail, needle, rev_start); found = strstrwrapper(filetail, needle, rev_start);
/* We've found a potential match. If we're not allowed to find /* If we've found a potential match and 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
* match is on that line, continue searching. */ * match is that filename, continue searching. */
if (found != NULL && (!no_sameline || currselected != begin)) if (found != NULL && (!no_sameline || currselected != begin))
break; break;
/* We've finished processing the filenames, so get out. */
if (search_last_file) { if (search_last_file) {
/* We've finished processing the filenames, so get out. */
not_found_msg(needle); not_found_msg(needle);
return FALSE; return FALSE;
} }
@ -812,8 +802,8 @@ bool findnextfile(bool no_sameline, size_t begin, const char *needle)
statusbar(_("Search Wrapped")); statusbar(_("Search Wrapped"));
} }
/* We've reached the original starting file. */
if (currselected == begin) if (currselected == begin)
/* We've reached the original starting file. */
search_last_file = TRUE; search_last_file = TRUE;
filetail = tail(filelist[currselected]); filetail = tail(filelist[currselected]);
@ -888,7 +878,7 @@ void do_filesearch(void)
filesearch_abort(); filesearch_abort();
} }
/* Search for the last filename without prompting. */ /* Search for the last given filename again without prompting. */
void do_fileresearch(void) void do_fileresearch(void)
{ {
size_t begin = selected; size_t begin = selected;