mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
vim: Fix >... (#15404)
Co-Authored-By: @Alextopher Release Notes: - vim: Fixed a hang when repeating an aborted operation ([#15399](https://github.com/zed-industries/zed/issues/15399)).
This commit is contained in:
parent
f58ef9b82b
commit
6db33b83d8
@ -1448,3 +1448,15 @@ async fn test_visual_indent_count(cx: &mut gpui::TestAppContext) {
|
|||||||
cx.simulate_keystrokes("shift-v 2 <");
|
cx.simulate_keystrokes("shift-v 2 <");
|
||||||
cx.assert_state(" ˇhi", Mode::Normal);
|
cx.assert_state(" ˇhi", Mode::Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[gpui::test]
|
||||||
|
async fn test_record_replay_recursion(cx: &mut gpui::TestAppContext) {
|
||||||
|
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||||
|
|
||||||
|
cx.set_shared_state("ˇhello world").await;
|
||||||
|
cx.simulate_shared_keystrokes(">").await;
|
||||||
|
cx.simulate_shared_keystrokes(".").await;
|
||||||
|
cx.simulate_shared_keystrokes(".").await;
|
||||||
|
cx.simulate_shared_keystrokes(".").await;
|
||||||
|
cx.shared_state().await.assert_eq("ˇhello world"); // takes a _long_ time
|
||||||
|
}
|
||||||
|
@ -189,25 +189,13 @@ fn observe_keystrokes(keystroke_event: &KeystrokeEvent, cx: &mut WindowContext)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vim::update(cx, |vim, cx| match vim.active_operator() {
|
Vim::update(cx, |vim, cx| {
|
||||||
Some(
|
if let Some(operator) = vim.active_operator() {
|
||||||
Operator::FindForward { .. }
|
if !operator.is_waiting(vim.state().mode) {
|
||||||
| Operator::FindBackward { .. }
|
vim.clear_operator(cx);
|
||||||
| Operator::Replace
|
vim.stop_recording_immediately(Box::new(ClearOperators))
|
||||||
| Operator::Digraph { .. }
|
}
|
||||||
| Operator::AddSurrounds { .. }
|
|
||||||
| Operator::ChangeSurrounds { .. }
|
|
||||||
| Operator::DeleteSurrounds
|
|
||||||
| Operator::Mark
|
|
||||||
| Operator::Jump { .. }
|
|
||||||
| Operator::Register
|
|
||||||
| Operator::RecordRegister
|
|
||||||
| Operator::ReplayRegister,
|
|
||||||
) => {}
|
|
||||||
Some(_) => {
|
|
||||||
vim.clear_operator(cx);
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
crates/vim/test_data/test_record_replay_recursion.json
Normal file
6
crates/vim/test_data/test_record_replay_recursion.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{"Put":{"state":"ˇhello world"}}
|
||||||
|
{"Key":">"}
|
||||||
|
{"Key":"."}
|
||||||
|
{"Key":"."}
|
||||||
|
{"Key":"."}
|
||||||
|
{"Get":{"state":"ˇhello world","mode":"Normal"}}
|
Loading…
Reference in New Issue
Block a user