degesch: some libedit fixes

This commit is contained in:
Přemysl Eric Janouch 2015-05-05 20:18:41 +02:00
parent fa0ee9d65b
commit e542aa5acc
1 changed files with 10 additions and 2 deletions

View File

@ -413,8 +413,9 @@ input_ding (struct input *self)
{ {
(void) self; (void) self;
// XXX: this isn't probably very portable // XXX: this isn't probably very portable;
putc ('\a', stdout); // we could use "bell" from terminfo but that creates a dependency
write (STDOUT_FILENO, "\a", 1);
} }
static void static void
@ -490,6 +491,9 @@ input_start (struct input *self, const char *program_name)
el_set (self->editline, EL_UNBUFFERED, true); el_set (self->editline, EL_UNBUFFERED, true);
el_set (self->editline, EL_EDITOR, "emacs"); el_set (self->editline, EL_EDITOR, "emacs");
// No, editline, it's not supposed to kill the entire line
el_set (self->editline, EL_BIND, "^W", "ed-delete-prev-word", NULL);
app_editline_init (self); app_editline_init (self);
self->prompt_shown = 1; self->prompt_shown = 1;
self->active = true; self->active = true;
@ -613,8 +617,12 @@ input_on_readable (struct input *self)
// The character is VEOF (usually C-d) // The character is VEOF (usually C-d)
// TODO: read it from terminal info // TODO: read it from terminal info
if (count == 0 && buf[0] == ('D' - 'A' + 1)) if (count == 0 && buf[0] == ('D' - 'A' + 1))
{
el_deletestr (self->editline, 1);
input_redisplay (self);
input_ding (self); input_ding (self);
} }
}
#endif // HAVE_EDITLINE #endif // HAVE_EDITLINE