Prevent the last fuck-up from happening again.
This commit is contained in:
Přemysl Eric Janouch 2020-10-13 20:30:03 +02:00
parent fcf65f8377
commit c87869bef7
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 16 additions and 13 deletions

View File

@ -663,6 +663,14 @@ input_el_install_prompt (struct input_el *self)
static unsigned char input_el_on_complete (EditLine *editline, int key); static unsigned char input_el_on_complete (EditLine *editline, int key);
static void
input_el_addbind (EditLine *editline, const char *name, const char *desc,
unsigned char (*function) (EditLine *, int), const char *binding)
{
el_set (editline, EL_ADDFN, name, desc, function);
el_set (editline, EL_BIND, binding, name, NULL);
}
static void static void
input_el_start (struct input *input, const char *program_name) input_el_start (struct input *input, const char *program_name)
{ {
@ -681,20 +689,15 @@ input_el_start (struct input *input, const char *program_name)
el_set (self->editline, EL_BIND, "^u", "vi-kill-line-prev", NULL); el_set (self->editline, EL_BIND, "^u", "vi-kill-line-prev", NULL);
// It's probably better to handle these ourselves // It's probably better to handle these ourselves
el_set (self->editline, EL_ADDFN, input_el_addbind (self->editline, "send-line", "Send line",
"send-line", "Send line", input_el_on_return); input_el_on_return, "\n");
el_set (self->editline, EL_BIND, "\n", "send-line", NULL); input_el_addbind (self->editline, "run-editor", "Run editor to edit line",
el_set (self->editline, EL_ADDFN, input_el_on_run_editor, "M-e");
"run-editor", "Run editor to edit line", input_el_on_run_editor);
el_set (self->editline, EL_BIND, "M-e", "run-editor", NULL);
el_set (self->editline, EL_ADDFN, input_el_addbind (self->editline, "complete", "Complete word",
"complete", "Complete word", input_el_on_complete); input_el_on_complete, "\t");
el_set (self->editline, EL_BIND, "\t", "complete", NULL); input_el_addbind (self->editline, "newline-insert", "Insert a newline",
input_el_on_newline_insert, "M-\n");
el_set (self->editline, EL_ADDFN,
"newline-insert", "Insert a newline", input_el_on_newline_insert);
el_set (self->editline, EL_BIND, "M-\n", "newline-insert", NULL);
// Source the user's defaults file // Source the user's defaults file
el_source (self->editline, NULL); el_source (self->editline, NULL);