vim: Fix increment step error (#26023)
Closes #12887 Release Notes: - Fixed `x g ctrl-a` step
This commit is contained in:
parent
161f8a1dd2
commit
6685d85f49
2 changed files with 20 additions and 2 deletions
|
@ -27,13 +27,13 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
|
|||
Vim::action(editor, cx, |vim, action: &Increment, window, cx| {
|
||||
vim.record_current_action(cx);
|
||||
let count = Vim::take_count(cx).unwrap_or(1);
|
||||
let step = if action.step { 1 } else { 0 };
|
||||
let step = if action.step { count as i32 } else { 0 };
|
||||
vim.increment(count as i64, step, window, cx)
|
||||
});
|
||||
Vim::action(editor, cx, |vim, action: &Decrement, window, cx| {
|
||||
vim.record_current_action(cx);
|
||||
let count = Vim::take_count(cx).unwrap_or(1);
|
||||
let step = if action.step { -1 } else { 0 };
|
||||
let step = if action.step { -1 * (count as i32) } else { 0 };
|
||||
vim.increment(-(count as i64), step, window, cx)
|
||||
});
|
||||
}
|
||||
|
@ -590,5 +590,13 @@ mod test {
|
|||
0 2
|
||||
0
|
||||
0"});
|
||||
cx.simulate_shared_keystrokes("v shift-g g ctrl-a").await;
|
||||
cx.simulate_shared_keystrokes("v shift-g 5 g ctrl-a").await;
|
||||
cx.shared_state().await.assert_eq(indoc! {"
|
||||
ˇ6
|
||||
12
|
||||
18 2
|
||||
24
|
||||
30"});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue