Not bothering to set 'answer'; just using 'last_search', which has already

been set to 'answer' in search_init() when 'answer' isn't empty, and when
'answer' /is/ empty we use 'last_search' anyway.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5755 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-03-20 16:19:30 +00:00
parent b3b2fa8856
commit b8a47f4e37
2 changed files with 3 additions and 5 deletions

View File

@ -9,6 +9,8 @@
* src/files.c (do_writeout): When the name of the file was changed, * src/files.c (do_writeout): When the name of the file was changed,
always ask whether this is okay. This fixes Savannah bug #46894. always ask whether this is okay. This fixes Savannah bug #46894.
* src/search.c (do_research): Use 'return' instead of 'else'. * src/search.c (do_research): Use 'return' instead of 'else'.
* src/search.c (do_search): Don't bother setting 'answer'; just use
'last_search', which has been set to 'answer' in search_init().
2016-03-19 Benno Schulenberg <bensberg@justemail.net> 2016-03-19 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (search_init): Always remember the last typed string, * src/search.c (search_init): Always remember the last typed string,

View File

@ -434,16 +434,12 @@ void do_search(void)
if (i != 0) if (i != 0)
return; return;
/* If answer is empty, use what was last searched for. */
if (*answer == '\0')
answer = mallocstrcpy(answer, last_search);
findnextstr_wrap_reset(); findnextstr_wrap_reset();
didfind = findnextstr( didfind = findnextstr(
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
FALSE, FALSE,
#endif #endif
openfile->current, openfile->current_x, answer, NULL); openfile->current, openfile->current_x, last_search, NULL);
/* If we found something, and we're back at the exact same spot where /* If we found something, and we're back at the exact same spot where
* we started searching, then this is the only occurrence. */ * we started searching, then this is the only occurrence. */