degesch: fix prompt not showing up after change

When a backlog helper was running and the prompt changed,
it failed to restore within input_rl_show().

Since before input_rl_show() is called the prompt is empty
and in input_rl__restore() it will be changed to the new
version, just skip invoking any Readline functions within
input_rl_set_prompt() when the prompt is hidden.  Simple
and straight-forward.

This bug is what I hinted at in the previous commit.
This commit is contained in:
Přemysl Eric Janouch 2020-10-06 13:37:07 +02:00
parent 572a7cb804
commit d78cf10f04
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 3 additions and 5 deletions

View File

@ -321,17 +321,15 @@ input_rl_set_prompt (void *input, char *prompt)
struct input_rl *self = input;
cstr_set (&self->prompt, prompt);
if (!self->active)
if (!self->active || self->prompt_shown <= 0)
return;
// First reset the prompt to work around a bug in readline
rl_set_prompt ("");
if (self->prompt_shown > 0)
rl_redisplay ();
rl_redisplay ();
rl_set_prompt (self->prompt);
if (self->prompt_shown > 0)
rl_redisplay ();
rl_redisplay ();
}
static void