bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Prompt save/restore for vi movement argument


From: Grisha Levit
Subject: Prompt save/restore for vi movement argument
Date: Sat, 15 Apr 2023 23:42:33 -0400

Originally identified in [1] (FWIW, I only see the message in the archive,
not in my inbox).

[1]: https://lists.gnu.org/archive/html/bug-bash/2023-04/msg00043.html

bash --norc -o vi -in <<<$'\ec1234567'
(arg: 123456) Segmentation fault

I think it's just a matter of save/restore_prompt

----

diff --git a/lib/readline/vi_mode.c b/lib/readline/vi_mode.c
index 7396e316..ddd8fd95 100644
--- a/lib/readline/vi_mode.c
+++ b/lib/readline/vi_mode.c
@@ -1090,6 +1090,7 @@ _rl_vi_arg_dispatch (int c)
     }
   else
     {
+ rl_restore_prompt ();
       rl_clear_message ();
       rl_stuff_char (key);
       return 0; /* done */
@@ -1331,6 +1332,7 @@ rl_domove_read_callback (_rl_vimotion_cxt *m)
       rl_numeric_arg = _rl_digit_value (c);
       rl_explicit_arg = 1;
       RL_SETSTATE (RL_STATE_NUMERICARG);
+ rl_save_prompt ();
       rl_digit_loop1 ();
       rl_numeric_arg *= save;
       c = rl_vi_domove_getchar (m);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]