mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +03:00
Storing always the last-typed string, also when it's an invalid regex.
This fixes Savannah bug #47440. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5742 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
e753cd1c38
commit
a6740ba3fd
@ -1,3 +1,7 @@
|
|||||||
|
2016-03-19 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/search.c (search_init): Always remember the last typed string,
|
||||||
|
also when it's an invalid regex. This fixes Savannah bug #47440.
|
||||||
|
|
||||||
2016-03-17 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-17 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/search.c (do_research): Use the Search key bindings also during
|
* src/search.c (do_research): Use the Search key bindings also during
|
||||||
a Re-search, to enable cancelling. This fixes Savannah bug #47159.
|
a Re-search, to enable cancelling. This fixes Savannah bug #47159.
|
||||||
|
32
src/search.c
32
src/search.c
@ -206,10 +206,14 @@ int search_init(bool replacing, bool use_answer)
|
|||||||
|
|
||||||
if (i == -2 || i == 0 ) {
|
if (i == -2 || i == 0 ) {
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
/* Use last_search if answer is an empty string, or
|
/* If an answer was given, remember it. */
|
||||||
* answer if it isn't. */
|
if (*answer != '\0') {
|
||||||
if (ISSET(USE_REGEXP) && !regexp_init((i == -2) ?
|
last_search = mallocstrcpy(last_search, answer);
|
||||||
last_search : answer))
|
#ifndef DISABLE_HISTORIES
|
||||||
|
update_history(&search_history, answer);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
@ -431,18 +435,9 @@ void do_search(void)
|
|||||||
if (i != 0)
|
if (i != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If answer is now "", copy last_search into answer. */
|
/* If answer is empty, use what was last searched for. */
|
||||||
if (*answer == '\0')
|
if (*answer == '\0')
|
||||||
answer = mallocstrcpy(answer, last_search);
|
answer = mallocstrcpy(answer, last_search);
|
||||||
else
|
|
||||||
last_search = mallocstrcpy(last_search, answer);
|
|
||||||
|
|
||||||
#ifndef DISABLE_HISTORIES
|
|
||||||
/* If answer is not "", add this search string to the search history
|
|
||||||
* list. */
|
|
||||||
if (answer[0] != '\0')
|
|
||||||
update_history(&search_history, answer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
findnextstr_wrap_reset();
|
findnextstr_wrap_reset();
|
||||||
didfind = findnextstr(
|
didfind = findnextstr(
|
||||||
@ -850,15 +845,6 @@ void do_replace(void)
|
|||||||
if (i != 0)
|
if (i != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If answer is not "", add answer to the search history list and
|
|
||||||
* copy answer into last_search. */
|
|
||||||
if (answer[0] != '\0') {
|
|
||||||
#ifndef DISABLE_HISTORIES
|
|
||||||
update_history(&search_history, answer);
|
|
||||||
#endif
|
|
||||||
last_search = mallocstrcpy(last_search, answer);
|
|
||||||
}
|
|
||||||
|
|
||||||
last_replace = mallocstrcpy(last_replace, "");
|
last_replace = mallocstrcpy(last_replace, "");
|
||||||
|
|
||||||
i = do_prompt(FALSE,
|
i = do_prompt(FALSE,
|
||||||
|
Loading…
Reference in New Issue
Block a user