diff options
author | Chet Ramey <chet.ramey@case.edu> | 2023-04-27 15:33:37 -0400 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2023-04-27 15:33:37 -0400 |
commit | f156385efb545a5ab96a2461555955d7f280aac4 (patch) | |
tree | 4c4ede0b0755f46629e1076b884ccf03654f5d47 /vi_mode.c | |
parent | 14144013617be12f94b99b05bf0928a8d1eba743 (diff) | |
download | readline-devel.tar.gz |
asan updates to non-incremental search, redisplay; rework non-incremental search to avoid pointer aliasing issuesdevel
Diffstat (limited to 'vi_mode.c')
-rw-r--r-- | vi_mode.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -367,12 +367,12 @@ rl_vi_search (int count, int key) switch (key) { case '?': - _rl_free_saved_history_line (); + _rl_free_saved_search_line (); /* just in case */ rl_noninc_forward_search (count, key); break; case '/': - _rl_free_saved_history_line (); + _rl_free_saved_search_line (); rl_noninc_reverse_search (count, key); break; @@ -1090,6 +1090,7 @@ _rl_vi_arg_dispatch (int c) } else { + rl_restore_prompt (); rl_clear_message (); rl_stuff_char (key); return 0; /* done */ @@ -1320,7 +1321,7 @@ rl_domove_read_callback (_rl_vimotion_cxt *m) /* Readine vi motion char starting numeric argument */ else if (_rl_digit_p (c) && RL_ISSTATE (RL_STATE_CALLBACK) && RL_ISSTATE (RL_STATE_VIMOTION) && (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)) { - RL_SETSTATE (RL_STATE_NUMERICARG); + _rl_arg_init (); return (_rl_vi_arg_dispatch (c)); } #endif @@ -1330,7 +1331,7 @@ rl_domove_read_callback (_rl_vimotion_cxt *m) save = rl_numeric_arg; rl_numeric_arg = _rl_digit_value (c); rl_explicit_arg = 1; - RL_SETSTATE (RL_STATE_NUMERICARG); + _rl_arg_init (); rl_digit_loop1 (); rl_numeric_arg *= save; c = rl_vi_domove_getchar (m); @@ -1339,6 +1340,13 @@ rl_domove_read_callback (_rl_vimotion_cxt *m) m->motion = 0; return -1; } + else if (member (c, vi_motion) == 0) + { + m->motion = 0; + RL_UNSETSTATE (RL_STATE_VIMOTION); + RL_UNSETSTATE (RL_STATE_NUMERICARG); + return (1); + } m->motion = c; return (rl_domove_motion_callback (m)); } @@ -1363,6 +1371,7 @@ _rl_vi_domove_callback (_rl_vimotion_cxt *m) int c, r; m->motion = c = rl_vi_domove_getchar (m); + if (c < 0) return 1; /* EOF */ r = rl_domove_read_callback (m); |