On Tue, Nov 21, 2023, 00:57 Grisha Levit <grishale...@gmail.com> wrote:
> rl_trim_arg_from_keyseq fails to trim a negative argument entered with > universal-argument and fails to trim arguments if they have multiple > leading minus signs. > Also fails if the function to be executed is shadowed by a key map: bind '"XX": "foo"' bind -x '"X": ":"' Followed by: "\e2X": bash: bash_execute_unix_command: cannot find keymap for command >
From 73a6f6d9a462dccf2afd924dc2444d27d76747f9 Mon Sep 17 00:00:00 2001 From: Grisha Levit <grishale...@gmail.com> Date: Tue, 21 Nov 2023 13:27:08 -0500 Subject: [PATCH 2/2] arg trim with ANYOTHERKEY --- lib/readline/bind.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/readline/bind.c b/lib/readline/bind.c index 1c347fbe..c7ce35d5 100644 --- a/lib/readline/bind.c +++ b/lib/readline/bind.c @@ -874,7 +874,7 @@ int rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map) { register int i, j, parsing_digits; - unsigned char ic; + unsigned int ic; Keymap map0; if (map == 0) @@ -906,10 +906,11 @@ rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map) if (map[ic].type == ISKMAP) { - if (i + 1 == len) - return -1; map = FUNCTION_TO_KEYMAP (map, ic); - continue; + if (i + 1 == len) + ic = ANYOTHERKEY; + else + continue; } if (map[ic].type == ISFUNC) { -- 2.43.0