From 9a421171220cb5944f3097bc72369e8fd5850e78 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 7 May 2023 11:11:47 -0400 Subject: [PATCH] Make recursive call, add (nonworking) test cases --- helix-term/src/ui/editor.rs | 5 ++++- helix-term/tests/test/movement.rs | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 1c00b436b..d8b21e086 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -842,7 +842,10 @@ impl EditorView { } KeymapResult::NotFound => return Some(key_result), 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(); } return Some(KeymapResult::Cancelled(pending)); diff --git a/helix-term/tests/test/movement.rs b/helix-term/tests/test/movement.rs index 9a48cdbcb..46ae3c48e 100644 --- a/helix-term/tests/test/movement.rs +++ b/helix-term/tests/test/movement.rs @@ -410,6 +410,23 @@ async fn cursor_position_append_eof() -> anyhow::Result<()> { Ok(()) } +#[tokio::test(flavor = "multi_thread")] +async fn repeated_key_movement() -> anyhow::Result<()> { + test(( + "#[|f]#oo", + "]]", + 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")] async fn select_mode_tree_sitter_next_function_is_union_of_objects() -> anyhow::Result<()> { test_with_config(