Commit d865d7ac authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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: default avatarMarco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
No related merge requests found
Showing with 1 addition and 2 deletions
+1 -2
......@@ -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') {
......
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