From 727bce98cdcf5be5c26fa82ae1c2d0ae1b242fde Mon Sep 17 00:00:00 2001 From: dino Date: Tue, 28 Oct 2025 16:46:36 +0000 Subject: [PATCH] test(vim): add simple test to delete object with new object scope Introduce a simple test to verify that, if `PushObject { around: true, whitespace: false }` is used, the surrounding whitespace will not be deleted. --- crates/vim/src/normal/delete.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/vim/src/normal/delete.rs b/crates/vim/src/normal/delete.rs index 3bb580ec10650c3a77d26a7ab623b984d1d5ab85..1e23e08a4d28a3168300cd9a2dfebfd6aea963d2 100644 --- a/crates/vim/src/normal/delete.rs +++ b/crates/vim/src/normal/delete.rs @@ -214,9 +214,11 @@ fn ends_at_eof(map: &DisplaySnapshot, selection: &mut Selection) - #[cfg(test)] mod test { + use gpui::KeyBinding; use indoc::indoc; use crate::{ + PushObject, state::Mode, test::{NeovimBackedTestContext, VimTestContext}, }; @@ -765,4 +767,24 @@ mod test { .await .assert_matches(); } + + #[gpui::test] + async fn test_delete_object_scope(cx: &mut gpui::TestAppContext) { + let mut cx = VimTestContext::new(cx, true).await; + + cx.update(|_, cx| { + cx.bind_keys([KeyBinding::new( + "a", + PushObject { + around: true, + whitespace: false, + }, + Some("VimControl && !menu"), + )]); + }); + + cx.set_state("some 'ˇquotes' here", Mode::Normal); + cx.simulate_keystrokes("d a '"); + cx.assert_editor_state("some ˇ here"); + } }