Make recursive call, add (nonworking) test cases

This commit is contained in:
Sam 2023-05-07 11:11:47 -04:00
parent 497b7f3af8
commit 9a42117122
2 changed files with 21 additions and 1 deletions

View File

@ -842,7 +842,10 @@ fn handle_keymap_event(
} }
KeymapResult::NotFound => return Some(key_result), KeymapResult::NotFound => return Some(key_result),
KeymapResult::Cancelled(mut pending) => { KeymapResult::Cancelled(mut pending) => {
if !matches!(self.keymaps.get(mode, event), KeymapResult::NotFound) { if !matches!(
self.handle_keymap_event(mode, cxt, event),
Some(KeymapResult::NotFound)
) {
pending.pop(); pending.pop();
} }
return Some(KeymapResult::Cancelled(pending)); return Some(KeymapResult::Cancelled(pending));

View File

@ -410,6 +410,23 @@ async fn cursor_position_append_eof() -> anyhow::Result<()> {
Ok(()) Ok(())
} }
#[tokio::test(flavor = "multi_thread")]
async fn repeated_key_movement() -> anyhow::Result<()> {
test((
"#[|f]#oo",
"]]<space>",
helpers::platform_line("#[|f]#oo\n"),
))
.await?;
test((
"#[|f]#oo\n\nbar",
"]]p",
helpers::platform_line("#[foo\n|]#\nbar"),
))
.await?;
Ok(())
}
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
async fn select_mode_tree_sitter_next_function_is_union_of_objects() -> anyhow::Result<()> { async fn select_mode_tree_sitter_next_function_is_union_of_objects() -> anyhow::Result<()> {
test_with_config( test_with_config(