vim: Allow count and repeat for "r" and "shift-r" action (#13287)
Fixing the "r" action just involved adapting `normal_replace` to replace multiple characters. Fixing the "shift-r" command was less straightforward. The bindings for `vim::BeforeNormal` in replace mode were being overwritten and several other steps required for action repetition were not performed. Finally, the cursor adjustment after re-entering normal mode was duplicated (`vim::BeforeNormal` was now triggered correctly) so I removed the special case for replace mode. Release Notes: - Fixed vim "r" action to accept a count argument - Fixed vim "shift-r" action to accept a count argument and allow repetition --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
77b2da2b42
commit
dea928b00c
8 changed files with 109 additions and 10 deletions
24
crates/vim/test_data/test_r.json
Normal file
24
crates/vim/test_data/test_r.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{"Put":{"state":"ˇhello\n"}}
|
||||
{"Key":"r"}
|
||||
{"Key":"-"}
|
||||
{"Get":{"state":"ˇ-ello\n","mode":"Normal"}}
|
||||
{"Put":{"state":"ˇhello\n"}}
|
||||
{"Key":"3"}
|
||||
{"Key":"r"}
|
||||
{"Key":"-"}
|
||||
{"Get":{"state":"--ˇ-lo\n","mode":"Normal"}}
|
||||
{"Put":{"state":"ˇhello\n"}}
|
||||
{"Key":"r"}
|
||||
{"Key":"-"}
|
||||
{"Key":"2"}
|
||||
{"Key":"l"}
|
||||
{"Key":"."}
|
||||
{"Get":{"state":"-eˇ-lo\n","mode":"Normal"}}
|
||||
{"Put":{"state":"ˇhello world\n"}}
|
||||
{"Key":"2"}
|
||||
{"Key":"r"}
|
||||
{"Key":"-"}
|
||||
{"Key":"f"}
|
||||
{"Key":"w"}
|
||||
{"Key":"."}
|
||||
{"Get":{"state":"--llo -ˇ-rld\n","mode":"Normal"}}
|
10
crates/vim/test_data/test_replace_mode_repeat.json
Normal file
10
crates/vim/test_data/test_replace_mode_repeat.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{"Put":{"state":"ˇhello world\n"}}
|
||||
{"Key":"shift-r"}
|
||||
{"Key":"-"}
|
||||
{"Key":"-"}
|
||||
{"Key":"-"}
|
||||
{"Key":"escape"}
|
||||
{"Key":"4"}
|
||||
{"Key":"l"}
|
||||
{"Key":"."}
|
||||
{"Get":{"state":"---lo --ˇ-ld\n","mode":"Normal"}}
|
14
crates/vim/test_data/test_replace_mode_with_counts.json
Normal file
14
crates/vim/test_data/test_replace_mode_with_counts.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{"Put":{"state":"ˇhello\n"}}
|
||||
{"Key":"3"}
|
||||
{"Key":"shift-r"}
|
||||
{"Key":"-"}
|
||||
{"Key":"escape"}
|
||||
{"Get":{"state":"--ˇ-lo\n","mode":"Normal"}}
|
||||
{"Put":{"state":"ˇhello\n"}}
|
||||
{"Key":"3"}
|
||||
{"Key":"shift-r"}
|
||||
{"Key":"a"}
|
||||
{"Key":"b"}
|
||||
{"Key":"c"}
|
||||
{"Key":"escape"}
|
||||
{"Get":{"state":"abcabcabˇc\n","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue