nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit d865d7ac8ff15b4de4d1f1682def0978b57d68fa
parent 16d237ba1bfeb3ea5511966c3d345594f982249e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Mon,  5 Feb 2018 12:35:53 +0100

search: clear the existing answer when starting a new search

When doing for example: ^W xx ^R ^C ^W, the "xx" would again be shown
after the prompt.  This is wrong -- when starting a new search, the
current answer should be empty.

Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>

Diffstat:
Msrc/search.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -99,8 +99,7 @@ void search_init(bool replacing, bool keep_the_answer) static char *sofar = NULL; /* What the user has typed so far, before toggling something. */ - if (keep_the_answer) - sofar = mallocstrcpy(sofar, answer); + sofar = mallocstrcpy(sofar, keep_the_answer ? answer : ""); /* If something was searched for earlier, include it in the prompt. */ if (*last_search != '\0') {