Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
vim: fix dtx when x is immediately to the right
Brian Strauchf369e9a48be6
diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rsindex 01d8bec569e..d7a46888cc9 100644--- a/crates/vim/src/motion.rs+++ b/crates/vim/src/motion.rs@@ -434,10 +434,13 @@ impl Motion {SelectionGoal::None,),Matching => (matching(map, point), SelectionGoal::None),- FindForward { before, char } => (- find_forward(map, point, *before, *char, times),- SelectionGoal::None,- ),+ FindForward { before, char } => {+ if let Some(new_point) = find_forward(map, point, *before, *char, times) {+ return Some((new_point, SelectionGoal::None));+ } else {+ return None;+ }+ }FindBackward { after, char } => (find_backward(map, point, *after, *char, times),SelectionGoal::None,@@ -882,7 +885,7 @@ fn find_forward(before: bool,target: char,times: usize,-) -> DisplayPoint {+) -> Option<DisplayPoint> {let mut to = from;let mut found = false;@@ -897,12 +900,12 @@ fn find_forward(if found {if before && to.column() > 0 {*to.column_mut() -= 1;- map.clip_point(to, Bias::Left)+ Some(map.clip_point(to, Bias::Left))} else {- to+ Some(to)}} else {- from+ None}}diff --git a/crates/vim/src/normal/delete.rs b/crates/vim/src/normal/delete.rsindex ed9cdf19fad..cbcdcadca93 100644--- a/crates/vim/src/normal/delete.rs+++ b/crates/vim/src/normal/delete.rs@@ -472,4 +472,11 @@ mod test {the ˇlazy dog"}).await;}++ #[gpui::test]+ async fn test_delete_to_adjacent_character(cx: &mut gpui::TestAppContext) {+ let mut cx = NeovimBackedTestContext::new(cx).await;+ cx.assert_neovim_compatible("ˇax", ["d", "t", "x"]).await;+ cx.assert_neovim_compatible("aˇx", ["d", "t", "x"]).await;+ }}