libedit: bind the correct command when using "bind -k".

"ed-argument-digit" (i. e. command 0) was incorrectly used
instead.
This bug comes from the original sources imported in 1994
and has been confirmed in upstream NetBSD.

Reported by:	Yamagi Burmeister
Submitted by:	Christoph Mallon
MFC after:	3 days
This commit is contained in:
Pedro F. Giffuni 2013-01-01 19:20:51 +00:00
parent 5bf325556b
commit e1c01d08f1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244941

View File

@ -1250,7 +1250,7 @@ map_bind(EditLine *el, int argc, const char **argv)
char inbuf[EL_BUFSIZ]; char inbuf[EL_BUFSIZ];
char outbuf[EL_BUFSIZ]; char outbuf[EL_BUFSIZ];
const char *in = NULL; const char *in = NULL;
char *out = NULL; char *out;
el_bindings_t *bp, *ep; el_bindings_t *bp, *ep;
int cmd; int cmd;
int key; int key;
@ -1368,7 +1368,7 @@ map_bind(EditLine *el, int argc, const char **argv)
return (-1); return (-1);
} }
if (key) if (key)
term_set_arrow(el, in, key_map_str(el, out), ntype); term_set_arrow(el, in, key_map_cmd(el, cmd), ntype);
else { else {
if (in[1]) { if (in[1]) {
key_add(el, in, key_map_cmd(el, cmd), ntype); key_add(el, in, key_map_cmd(el, cmd), ntype);