summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-06 22:01:48 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-06 22:01:48 +0200
commit894c45bef4de37d2f035ba064c9b2d57c7820255 (patch)
tree803f9048dbb70123850e725c73b9ad9ee635fc64 /degesch.c
parent06ec2a1388384b5ad5e821c8846df4ec65af50e2 (diff)
downloadxK-894c45bef4de37d2f035ba064c9b2d57c7820255.tar.gz
xK-894c45bef4de37d2f035ba064c9b2d57c7820255.tar.xz
xK-894c45bef4de37d2f035ba064c9b2d57c7820255.zip
degesch: fix readline initialization
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/degesch.c b/degesch.c
index 851971c..0b7ee9c 100644
--- a/degesch.c
+++ b/degesch.c
@@ -220,17 +220,23 @@ static char **app_readline_completion (const char *text, int start, int end);
static void
input_start (struct input *self, const char *program_name)
{
- (void) program_name;
-
using_history ();
// This can cause memory leaks, or maybe even a segfault. Funny, eh?
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_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;
+
+ hard_assert (self->prompt != NULL);
+ rl_callback_handler_install (self->prompt, on_readline_input);
+
self->prompt_shown = 1;
self->active = true;
}
@@ -5531,6 +5537,7 @@ main (int argc, char *argv[])
init_poller_events (&ctx);
init_buffers (&ctx);
+ refresh_prompt (&ctx);
input_start (&ctx.input, argv[0]);
buffer_activate (&ctx, ctx.server.buffer);