From d78cf10f04723b513e8b7b065a878643de777ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Tue, 6 Oct 2020 13:37:07 +0200 Subject: [PATCH] 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. --- degesch.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/degesch.c b/degesch.c index 8cba5da..d3e31a8 100644 --- a/degesch.c +++ b/degesch.c @@ -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