xC: fix newer libedit (2021-08-29)

This commit is contained in:
Přemysl Eric Janouch 2021-10-28 08:18:15 +02:00
parent 5e728f6d31
commit e5ed89646b
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 5 additions and 14 deletions

19
xC.c
View File

@ -771,24 +771,13 @@ struct input_el
static void app_editline_init (struct input_el *self);
static int
input_el__get_termios (int character, int fallback)
{
if (!g_terminal.initialized)
return fallback;
cc_t value = g_terminal.termios.c_cc[character];
if (value == _POSIX_VDISABLE)
return fallback;
return value;
}
static void
input_el__redisplay (void *input)
{
// See rl_redisplay()
// See rl_redisplay(), however NetBSD editline's map.c v1.54 breaks VREPRINT
// so we bind redisplay somewhere else in app_editline_init()
struct input_el *self = input;
char x[] = { input_el__get_termios (VREPRINT, 'R' - 0x40), 0 };
char x[] = { 'q' & 31, 0 };
el_push (self->editline, x);
// We have to do this or it gets stuck and nothing is done
@ -13782,6 +13771,8 @@ app_editline_init (struct input_el *self)
CALL_ (input, bind_control, 'w', "ed-delete-prev-word");
// Just what are you doing?
CALL_ (input, bind_control, 'u', "vi-kill-line-prev");
// See input_el__redisplay(), functionally important
CALL_ (input, bind_control, 'q', "ed-redisplay");
// We need to hide the prompt and input first
CALL_ (input, bind, "\n", "send-line");