degesch: input_set_prompt() can be called whenever

This commit is contained in:
Přemysl Eric Janouch 2015-05-12 07:07:02 +02:00
parent 24546dd724
commit c5b38842bf
1 changed files with 5 additions and 0 deletions

View File

@ -197,6 +197,9 @@ input_set_prompt (struct input *self, char *prompt)
free (self->prompt); free (self->prompt);
self->prompt = prompt; self->prompt = prompt;
if (!self->active)
return;
// First reset the prompt to work around a bug in readline // First reset the prompt to work around a bug in readline
rl_set_prompt (""); rl_set_prompt ("");
if (self->prompt_shown) if (self->prompt_shown)
@ -294,6 +297,7 @@ input_stop (struct input *self)
// This is okay as long as we're not called from within readline // This is okay as long as we're not called from within readline
rl_callback_handler_remove (); rl_callback_handler_remove ();
self->active = false; self->active = false;
self->prompt_shown = false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -591,6 +595,7 @@ input_stop (struct input *self)
el_end (self->editline); el_end (self->editline);
self->editline = NULL; self->editline = NULL;
self->active = false; self->active = false;
self->prompt_shown = false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -