aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-28 08:29:20 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-28 08:30:41 +0200
commit87a644cc597f151d55497d6437135327a68ce0e0 (patch)
tree533a1694c23f7e3c23bd75e6a3636527c08f6633
parent990cf5a1d4047d84921b85cb82b485d4cee75426 (diff)
downloadjson-rpc-shell-87a644cc597f151d55497d6437135327a68ce0e0.tar.gz
json-rpc-shell-87a644cc597f151d55497d6437135327a68ce0e0.tar.xz
json-rpc-shell-87a644cc597f151d55497d6437135327a68ce0e0.zip
Fix newer libedit (2021-08-29)
-rw-r--r--json-rpc-shell.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/json-rpc-shell.c b/json-rpc-shell.c
index 70f4818..9570535 100644
--- a/json-rpc-shell.c
+++ b/json-rpc-shell.c
@@ -535,22 +535,12 @@ input_el_wcstombs (const wchar_t *s)
return mb;
}
-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 (struct input_el *self)
{
- char x[] = { input_el_get_termios (VREPRINT, 'R' - 0x40), 0 };
+ // See rl_redisplay(), however NetBSD editline's map.c v1.54 breaks VREPRINT
+ // so we bind redisplay somewhere else in input_el_start()
+ char x[] = { 'q' & 31, 0 };
el_push (self->editline, x);
// We have to do this or it gets stuck and nothing is done
@@ -683,6 +673,8 @@ input_el_start (struct input *input, const char *program_name)
el_set (self->editline, EL_BIND, "^w", "ed-delete-prev-word", NULL);
// Just what are you doing?
el_set (self->editline, EL_BIND, "^u", "vi-kill-line-prev", NULL);
+ // See input_el_redisplay(), functionally important
+ el_set (self->editline, EL_BIND, "^q", "ed-redisplay", NULL);
// It's probably better to handle these ourselves
input_el_addbind (self->editline, "send-line", "Send line",