degesch: fix readline initialization
This commit is contained in:
parent
06ec2a1388
commit
894c45bef4
15
degesch.c
15
degesch.c
|
@ -220,17 +220,23 @@ static char **app_readline_completion (const char *text, int start, int end);
|
||||||
static void
|
static void
|
||||||
input_start (struct input *self, const char *program_name)
|
input_start (struct input *self, const char *program_name)
|
||||||
{
|
{
|
||||||
(void) program_name;
|
|
||||||
|
|
||||||
using_history ();
|
using_history ();
|
||||||
// This can cause memory leaks, or maybe even a segfault. Funny, eh?
|
// This can cause memory leaks, or maybe even a segfault. Funny, eh?
|
||||||
stifle_history (HISTORY_LIMIT);
|
stifle_history (HISTORY_LIMIT);
|
||||||
|
|
||||||
rl_readline_name = PROGRAM_NAME;
|
const char *slash = strrchr (program_name, '/');
|
||||||
|
rl_readline_name = slash ? ++slash : program_name;
|
||||||
rl_startup_hook = app_readline_init;
|
rl_startup_hook = app_readline_init;
|
||||||
rl_catch_sigwinch = false;
|
rl_catch_sigwinch = false;
|
||||||
rl_callback_handler_install (self->prompt, on_readline_input);
|
|
||||||
|
// TODO: global constant
|
||||||
|
rl_basic_word_break_characters = " \t";
|
||||||
|
rl_completer_word_break_characters = NULL;
|
||||||
rl_attempted_completion_function = app_readline_completion;
|
rl_attempted_completion_function = app_readline_completion;
|
||||||
|
|
||||||
|
hard_assert (self->prompt != NULL);
|
||||||
|
rl_callback_handler_install (self->prompt, on_readline_input);
|
||||||
|
|
||||||
self->prompt_shown = 1;
|
self->prompt_shown = 1;
|
||||||
self->active = true;
|
self->active = true;
|
||||||
}
|
}
|
||||||
|
@ -5531,6 +5537,7 @@ main (int argc, char *argv[])
|
||||||
init_poller_events (&ctx);
|
init_poller_events (&ctx);
|
||||||
init_buffers (&ctx);
|
init_buffers (&ctx);
|
||||||
|
|
||||||
|
refresh_prompt (&ctx);
|
||||||
input_start (&ctx.input, argv[0]);
|
input_start (&ctx.input, argv[0]);
|
||||||
buffer_activate (&ctx, ctx.server.buffer);
|
buffer_activate (&ctx, ctx.server.buffer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue