vim: Fix count handling to allow pre/post counts

Fixes 2yy, d3d, etc.

For zed-industries/community#970
For zed-industries/community#1496
This commit is contained in:
Conrad Irwin 2023-09-11 13:10:01 -06:00
parent e8a6ecd6ac
commit cee549e1ef
13 changed files with 175 additions and 54 deletions

View file

@ -11,7 +11,7 @@ pub(crate) fn init(cx: &mut AppContext) {
cx.add_action(|_: &mut Workspace, _: &Substitute, cx| {
Vim::update(cx, |vim, cx| {
vim.start_recording(cx);
let count = vim.pop_number_operator(cx);
let count = vim.take_count();
substitute(vim, count, vim.state().mode == Mode::VisualLine, cx);
})
});
@ -22,7 +22,7 @@ pub(crate) fn init(cx: &mut AppContext) {
if matches!(vim.state().mode, Mode::VisualBlock | Mode::Visual) {
vim.switch_mode(Mode::VisualLine, false, cx)
}
let count = vim.pop_number_operator(cx);
let count = vim.take_count();
substitute(vim, count, true, cx)
})
});