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>master
parent
16d237ba1b
commit
d865d7ac8f
|
@ -99,8 +99,7 @@ void search_init(bool replacing, bool keep_the_answer)
|
||||||
static char *sofar = NULL;
|
static char *sofar = NULL;
|
||||||
/* What the user has typed so far, before toggling something. */
|
/* What the user has typed so far, before toggling something. */
|
||||||
|
|
||||||
if (keep_the_answer)
|
sofar = mallocstrcpy(sofar, keep_the_answer ? answer : "");
|
||||||
sofar = mallocstrcpy(sofar, answer);
|
|
||||||
|
|
||||||
/* If something was searched for earlier, include it in the prompt. */
|
/* If something was searched for earlier, include it in the prompt. */
|
||||||
if (*last_search != '\0') {
|
if (*last_search != '\0') {
|
||||||
|
|
Loading…
Reference in New Issue