Detailed changes
@@ -230,6 +230,12 @@ impl DispatchTree {
}
}
+ pub fn has_pending_keystrokes(&self) -> bool {
+ self.keystroke_matchers
+ .iter()
+ .any(|(_, matcher)| matcher.has_pending_keystrokes())
+ }
+
pub fn dispatch_path(&self, target: DispatchNodeId) -> SmallVec<[DispatchNodeId; 32]> {
let mut dispatch_path: SmallVec<[DispatchNodeId; 32]> = SmallVec::new();
let mut current_node_id = Some(target);
@@ -1451,6 +1451,13 @@ impl<'a> WindowContext<'a> {
self.dispatch_keystroke_observers(event, None);
}
+ pub fn has_pending_keystrokes(&self) -> bool {
+ self.window
+ .rendered_frame
+ .dispatch_tree
+ .has_pending_keystrokes()
+ }
+
fn dispatch_action_on_node(&mut self, node_id: DispatchNodeId, action: Box<dyn Action>) {
let dispatch_path = self
.window
@@ -130,373 +130,373 @@ fn expand_changed_word_selection(
}
}
-// #[cfg(test)]
-// mod test {
-// use indoc::indoc;
-
-// use crate::test::NeovimBackedTestContext;
-
-// #[gpui::test]
-// async fn test_change_h(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "h"]);
-// cx.assert("Teˇst").await;
-// cx.assert("Tˇest").await;
-// cx.assert("ˇTest").await;
-// cx.assert(indoc! {"
-// Test
-// ˇtest"})
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_change_backspace(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx)
-// .await
-// .binding(["c", "backspace"]);
-// cx.assert("Teˇst").await;
-// cx.assert("Tˇest").await;
-// cx.assert("ˇTest").await;
-// cx.assert(indoc! {"
-// Test
-// ˇtest"})
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_change_l(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "l"]);
-// cx.assert("Teˇst").await;
-// cx.assert("Tesˇt").await;
-// }
-
-// #[gpui::test]
-// async fn test_change_w(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "w"]);
-// cx.assert("Teˇst").await;
-// cx.assert("Tˇest test").await;
-// cx.assert("Testˇ test").await;
-// cx.assert(indoc! {"
-// Test teˇst
-// test"})
-// .await;
-// cx.assert(indoc! {"
-// Test tesˇt
-// test"})
-// .await;
-// cx.assert(indoc! {"
-// Test test
-// ˇ
-// test"})
-// .await;
-
-// let mut cx = cx.binding(["c", "shift-w"]);
-// cx.assert("Test teˇst-test test").await;
-// }
-
-// #[gpui::test]
-// async fn test_change_e(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "e"]);
-// cx.assert("Teˇst Test").await;
-// cx.assert("Tˇest test").await;
-// cx.assert(indoc! {"
-// Test teˇst
-// test"})
-// .await;
-// cx.assert(indoc! {"
-// Test tesˇt
-// test"})
-// .await;
-// cx.assert(indoc! {"
-// Test test
-// ˇ
-// test"})
-// .await;
-
-// let mut cx = cx.binding(["c", "shift-e"]);
-// cx.assert("Test teˇst-test test").await;
-// }
-
-// #[gpui::test]
-// async fn test_change_b(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "b"]);
-// cx.assert("Teˇst Test").await;
-// cx.assert("Test ˇtest").await;
-// cx.assert("Test1 test2 ˇtest3").await;
-// cx.assert(indoc! {"
-// Test test
-// ˇtest"})
-// .await;
-// cx.assert(indoc! {"
-// Test test
-// ˇ
-// test"})
-// .await;
-
-// let mut cx = cx.binding(["c", "shift-b"]);
-// cx.assert("Test test-test ˇtest").await;
-// }
-
-// #[gpui::test]
-// async fn test_change_end_of_line(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "$"]);
-// cx.assert(indoc! {"
-// The qˇuick
-// brown fox"})
-// .await;
-// cx.assert(indoc! {"
-// The quick
-// ˇ
-// brown fox"})
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_change_0(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The qˇuick
-// brown fox"},
-// ["c", "0"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// ˇ
-// brown fox"},
-// ["c", "0"],
-// )
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_change_k(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown ˇfox
-// jumps over"},
-// ["c", "k"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps ˇover"},
-// ["c", "k"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The qˇuick
-// brown fox
-// jumps over"},
-// ["c", "k"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// ˇ
-// brown fox
-// jumps over"},
-// ["c", "k"],
-// )
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_change_j(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown ˇfox
-// jumps over"},
-// ["c", "j"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps ˇover"},
-// ["c", "j"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The qˇuick
-// brown fox
-// jumps over"},
-// ["c", "j"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// ˇ"},
-// ["c", "j"],
-// )
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_change_end_of_document(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brownˇ fox
-// jumps over
-// the lazy"},
-// ["c", "shift-g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brownˇ fox
-// jumps over
-// the lazy"},
-// ["c", "shift-g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps over
-// the lˇazy"},
-// ["c", "shift-g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps over
-// ˇ"},
-// ["c", "shift-g"],
-// )
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_change_gg(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brownˇ fox
-// jumps over
-// the lazy"},
-// ["c", "g", "g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps over
-// the lˇazy"},
-// ["c", "g", "g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The qˇuick
-// brown fox
-// jumps over
-// the lazy"},
-// ["c", "g", "g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// ˇ
-// brown fox
-// jumps over
-// the lazy"},
-// ["c", "g", "g"],
-// )
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_repeated_cj(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// for count in 1..=5 {
-// cx.assert_binding_matches_all(
-// ["c", &count.to_string(), "j"],
-// indoc! {"
-// ˇThe quˇickˇ browˇn
-// ˇ
-// ˇfox ˇjumpsˇ-ˇoˇver
-// ˇthe lazy dog
-// "},
-// )
-// .await;
-// }
-// }
-
-// #[gpui::test]
-// async fn test_repeated_cl(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// for count in 1..=5 {
-// cx.assert_binding_matches_all(
-// ["c", &count.to_string(), "l"],
-// indoc! {"
-// ˇThe quˇickˇ browˇn
-// ˇ
-// ˇfox ˇjumpsˇ-ˇoˇver
-// ˇthe lazy dog
-// "},
-// )
-// .await;
-// }
-// }
-
-// #[gpui::test]
-// async fn test_repeated_cb(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// for count in 1..=5 {
-// for marked_text in cx.each_marked_position(indoc! {"
-// ˇThe quˇickˇ browˇn
-// ˇ
-// ˇfox ˇjumpsˇ-ˇoˇver
-// ˇthe lazy dog
-// "})
-// {
-// cx.assert_neovim_compatible(&marked_text, ["c", &count.to_string(), "b"])
-// .await;
-// }
-// }
-// }
-
-// #[gpui::test]
-// async fn test_repeated_ce(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// for count in 1..=5 {
-// cx.assert_binding_matches_all(
-// ["c", &count.to_string(), "e"],
-// indoc! {"
-// ˇThe quˇickˇ browˇn
-// ˇ
-// ˇfox ˇjumpsˇ-ˇoˇver
-// ˇthe lazy dog
-// "},
-// )
-// .await;
-// }
-// }
-// }
+#[cfg(test)]
+mod test {
+ use indoc::indoc;
+
+ use crate::test::NeovimBackedTestContext;
+
+ #[gpui::test]
+ async fn test_change_h(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "h"]);
+ cx.assert("Teˇst").await;
+ cx.assert("Tˇest").await;
+ cx.assert("ˇTest").await;
+ cx.assert(indoc! {"
+ Test
+ ˇtest"})
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_change_backspace(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx)
+ .await
+ .binding(["c", "backspace"]);
+ cx.assert("Teˇst").await;
+ cx.assert("Tˇest").await;
+ cx.assert("ˇTest").await;
+ cx.assert(indoc! {"
+ Test
+ ˇtest"})
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_change_l(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "l"]);
+ cx.assert("Teˇst").await;
+ cx.assert("Tesˇt").await;
+ }
+
+ #[gpui::test]
+ async fn test_change_w(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "w"]);
+ cx.assert("Teˇst").await;
+ cx.assert("Tˇest test").await;
+ cx.assert("Testˇ test").await;
+ cx.assert(indoc! {"
+ Test teˇst
+ test"})
+ .await;
+ cx.assert(indoc! {"
+ Test tesˇt
+ test"})
+ .await;
+ cx.assert(indoc! {"
+ Test test
+ ˇ
+ test"})
+ .await;
+
+ let mut cx = cx.binding(["c", "shift-w"]);
+ cx.assert("Test teˇst-test test").await;
+ }
+
+ #[gpui::test]
+ async fn test_change_e(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "e"]);
+ cx.assert("Teˇst Test").await;
+ cx.assert("Tˇest test").await;
+ cx.assert(indoc! {"
+ Test teˇst
+ test"})
+ .await;
+ cx.assert(indoc! {"
+ Test tesˇt
+ test"})
+ .await;
+ cx.assert(indoc! {"
+ Test test
+ ˇ
+ test"})
+ .await;
+
+ let mut cx = cx.binding(["c", "shift-e"]);
+ cx.assert("Test teˇst-test test").await;
+ }
+
+ #[gpui::test]
+ async fn test_change_b(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "b"]);
+ cx.assert("Teˇst Test").await;
+ cx.assert("Test ˇtest").await;
+ cx.assert("Test1 test2 ˇtest3").await;
+ cx.assert(indoc! {"
+ Test test
+ ˇtest"})
+ .await;
+ cx.assert(indoc! {"
+ Test test
+ ˇ
+ test"})
+ .await;
+
+ let mut cx = cx.binding(["c", "shift-b"]);
+ cx.assert("Test test-test ˇtest").await;
+ }
+
+ #[gpui::test]
+ async fn test_change_end_of_line(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["c", "$"]);
+ cx.assert(indoc! {"
+ The qˇuick
+ brown fox"})
+ .await;
+ cx.assert(indoc! {"
+ The quick
+ ˇ
+ brown fox"})
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_change_0(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The qˇuick
+ brown fox"},
+ ["c", "0"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ ˇ
+ brown fox"},
+ ["c", "0"],
+ )
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_change_k(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown ˇfox
+ jumps over"},
+ ["c", "k"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps ˇover"},
+ ["c", "k"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The qˇuick
+ brown fox
+ jumps over"},
+ ["c", "k"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ ˇ
+ brown fox
+ jumps over"},
+ ["c", "k"],
+ )
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_change_j(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown ˇfox
+ jumps over"},
+ ["c", "j"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps ˇover"},
+ ["c", "j"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The qˇuick
+ brown fox
+ jumps over"},
+ ["c", "j"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ ˇ"},
+ ["c", "j"],
+ )
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_change_end_of_document(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brownˇ fox
+ jumps over
+ the lazy"},
+ ["c", "shift-g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brownˇ fox
+ jumps over
+ the lazy"},
+ ["c", "shift-g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps over
+ the lˇazy"},
+ ["c", "shift-g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps over
+ ˇ"},
+ ["c", "shift-g"],
+ )
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_change_gg(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brownˇ fox
+ jumps over
+ the lazy"},
+ ["c", "g", "g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps over
+ the lˇazy"},
+ ["c", "g", "g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The qˇuick
+ brown fox
+ jumps over
+ the lazy"},
+ ["c", "g", "g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ ˇ
+ brown fox
+ jumps over
+ the lazy"},
+ ["c", "g", "g"],
+ )
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_repeated_cj(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ for count in 1..=5 {
+ cx.assert_binding_matches_all(
+ ["c", &count.to_string(), "j"],
+ indoc! {"
+ ˇThe quˇickˇ browˇn
+ ˇ
+ ˇfox ˇjumpsˇ-ˇoˇver
+ ˇthe lazy dog
+ "},
+ )
+ .await;
+ }
+ }
+
+ #[gpui::test]
+ async fn test_repeated_cl(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ for count in 1..=5 {
+ cx.assert_binding_matches_all(
+ ["c", &count.to_string(), "l"],
+ indoc! {"
+ ˇThe quˇickˇ browˇn
+ ˇ
+ ˇfox ˇjumpsˇ-ˇoˇver
+ ˇthe lazy dog
+ "},
+ )
+ .await;
+ }
+ }
+
+ #[gpui::test]
+ async fn test_repeated_cb(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ for count in 1..=5 {
+ for marked_text in cx.each_marked_position(indoc! {"
+ ˇThe quˇickˇ browˇn
+ ˇ
+ ˇfox ˇjumpsˇ-ˇoˇver
+ ˇthe lazy dog
+ "})
+ {
+ cx.assert_neovim_compatible(&marked_text, ["c", &count.to_string(), "b"])
+ .await;
+ }
+ }
+ }
+
+ #[gpui::test]
+ async fn test_repeated_ce(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ for count in 1..=5 {
+ cx.assert_binding_matches_all(
+ ["c", &count.to_string(), "e"],
+ indoc! {"
+ ˇThe quˇickˇ browˇn
+ ˇ
+ ˇfox ˇjumpsˇ-ˇoˇver
+ ˇthe lazy dog
+ "},
+ )
+ .await;
+ }
+ }
+}
@@ -117,359 +117,359 @@ pub fn delete_object(vim: &mut Vim, object: Object, around: bool, cx: &mut Windo
});
}
-// #[cfg(test)]
-// mod test {
-// use indoc::indoc;
+#[cfg(test)]
+mod test {
+ use indoc::indoc;
-// use crate::{
-// state::Mode,
-// test::{ExemptionFeatures, NeovimBackedTestContext, VimTestContext},
-// };
+ use crate::{
+ state::Mode,
+ test::{ExemptionFeatures, NeovimBackedTestContext, VimTestContext},
+ };
-// #[gpui::test]
-// async fn test_delete_h(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "h"]);
-// cx.assert("Teˇst").await;
-// cx.assert("Tˇest").await;
-// cx.assert("ˇTest").await;
-// cx.assert(indoc! {"
-// Test
-// ˇtest"})
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_h(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "h"]);
+ cx.assert("Teˇst").await;
+ cx.assert("Tˇest").await;
+ cx.assert("ˇTest").await;
+ cx.assert(indoc! {"
+ Test
+ ˇtest"})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_l(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "l"]);
-// cx.assert("ˇTest").await;
-// cx.assert("Teˇst").await;
-// cx.assert("Tesˇt").await;
-// cx.assert(indoc! {"
-// Tesˇt
-// test"})
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_l(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "l"]);
+ cx.assert("ˇTest").await;
+ cx.assert("Teˇst").await;
+ cx.assert("Tesˇt").await;
+ cx.assert(indoc! {"
+ Tesˇt
+ test"})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_w(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// Test tesˇt
-// test"},
-// ["d", "w"],
-// )
-// .await;
+ #[gpui::test]
+ async fn test_delete_w(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ Test tesˇt
+ test"},
+ ["d", "w"],
+ )
+ .await;
-// cx.assert_neovim_compatible("Teˇst", ["d", "w"]).await;
-// cx.assert_neovim_compatible("Tˇest test", ["d", "w"]).await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// Test teˇst
-// test"},
-// ["d", "w"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// Test tesˇt
-// test"},
-// ["d", "w"],
-// )
-// .await;
+ cx.assert_neovim_compatible("Teˇst", ["d", "w"]).await;
+ cx.assert_neovim_compatible("Tˇest test", ["d", "w"]).await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ Test teˇst
+ test"},
+ ["d", "w"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ Test tesˇt
+ test"},
+ ["d", "w"],
+ )
+ .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// Test test
-// ˇ
-// test"},
-// ["d", "w"],
-// )
-// .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ Test test
+ ˇ
+ test"},
+ ["d", "w"],
+ )
+ .await;
-// let mut cx = cx.binding(["d", "shift-w"]);
-// cx.assert_neovim_compatible("Test teˇst-test test", ["d", "shift-w"])
-// .await;
-// }
+ let mut cx = cx.binding(["d", "shift-w"]);
+ cx.assert_neovim_compatible("Test teˇst-test test", ["d", "shift-w"])
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_next_word_end(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "e"]);
-// // cx.assert("Teˇst Test").await;
-// // cx.assert("Tˇest test").await;
-// cx.assert(indoc! {"
-// Test teˇst
-// test"})
-// .await;
-// cx.assert(indoc! {"
-// Test tesˇt
-// test"})
-// .await;
-// cx.assert_exempted(
-// indoc! {"
-// Test test
-// ˇ
-// test"},
-// ExemptionFeatures::OperatorLastNewlineRemains,
-// )
-// .await;
+ #[gpui::test]
+ async fn test_delete_next_word_end(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "e"]);
+ // cx.assert("Teˇst Test").await;
+ // cx.assert("Tˇest test").await;
+ cx.assert(indoc! {"
+ Test teˇst
+ test"})
+ .await;
+ cx.assert(indoc! {"
+ Test tesˇt
+ test"})
+ .await;
+ cx.assert_exempted(
+ indoc! {"
+ Test test
+ ˇ
+ test"},
+ ExemptionFeatures::OperatorLastNewlineRemains,
+ )
+ .await;
-// let mut cx = cx.binding(["d", "shift-e"]);
-// cx.assert("Test teˇst-test test").await;
-// }
+ let mut cx = cx.binding(["d", "shift-e"]);
+ cx.assert("Test teˇst-test test").await;
+ }
-// #[gpui::test]
-// async fn test_delete_b(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "b"]);
-// cx.assert("Teˇst Test").await;
-// cx.assert("Test ˇtest").await;
-// cx.assert("Test1 test2 ˇtest3").await;
-// cx.assert(indoc! {"
-// Test test
-// ˇtest"})
-// .await;
-// cx.assert(indoc! {"
-// Test test
-// ˇ
-// test"})
-// .await;
+ #[gpui::test]
+ async fn test_delete_b(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "b"]);
+ cx.assert("Teˇst Test").await;
+ cx.assert("Test ˇtest").await;
+ cx.assert("Test1 test2 ˇtest3").await;
+ cx.assert(indoc! {"
+ Test test
+ ˇtest"})
+ .await;
+ cx.assert(indoc! {"
+ Test test
+ ˇ
+ test"})
+ .await;
-// let mut cx = cx.binding(["d", "shift-b"]);
-// cx.assert("Test test-test ˇtest").await;
-// }
+ let mut cx = cx.binding(["d", "shift-b"]);
+ cx.assert("Test test-test ˇtest").await;
+ }
-// #[gpui::test]
-// async fn test_delete_end_of_line(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "$"]);
-// cx.assert(indoc! {"
-// The qˇuick
-// brown fox"})
-// .await;
-// cx.assert(indoc! {"
-// The quick
-// ˇ
-// brown fox"})
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_end_of_line(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "$"]);
+ cx.assert(indoc! {"
+ The qˇuick
+ brown fox"})
+ .await;
+ cx.assert(indoc! {"
+ The quick
+ ˇ
+ brown fox"})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_0(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "0"]);
-// cx.assert(indoc! {"
-// The qˇuick
-// brown fox"})
-// .await;
-// cx.assert(indoc! {"
-// The quick
-// ˇ
-// brown fox"})
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_0(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "0"]);
+ cx.assert(indoc! {"
+ The qˇuick
+ brown fox"})
+ .await;
+ cx.assert(indoc! {"
+ The quick
+ ˇ
+ brown fox"})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_k(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "k"]);
-// cx.assert(indoc! {"
-// The quick
-// brown ˇfox
-// jumps over"})
-// .await;
-// cx.assert(indoc! {"
-// The quick
-// brown fox
-// jumps ˇover"})
-// .await;
-// cx.assert(indoc! {"
-// The qˇuick
-// brown fox
-// jumps over"})
-// .await;
-// cx.assert(indoc! {"
-// ˇbrown fox
-// jumps over"})
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_k(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "k"]);
+ cx.assert(indoc! {"
+ The quick
+ brown ˇfox
+ jumps over"})
+ .await;
+ cx.assert(indoc! {"
+ The quick
+ brown fox
+ jumps ˇover"})
+ .await;
+ cx.assert(indoc! {"
+ The qˇuick
+ brown fox
+ jumps over"})
+ .await;
+ cx.assert(indoc! {"
+ ˇbrown fox
+ jumps over"})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_j(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "j"]);
-// cx.assert(indoc! {"
-// The quick
-// brown ˇfox
-// jumps over"})
-// .await;
-// cx.assert(indoc! {"
-// The quick
-// brown fox
-// jumps ˇover"})
-// .await;
-// cx.assert(indoc! {"
-// The qˇuick
-// brown fox
-// jumps over"})
-// .await;
-// cx.assert(indoc! {"
-// The quick
-// brown fox
-// ˇ"})
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_j(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await.binding(["d", "j"]);
+ cx.assert(indoc! {"
+ The quick
+ brown ˇfox
+ jumps over"})
+ .await;
+ cx.assert(indoc! {"
+ The quick
+ brown fox
+ jumps ˇover"})
+ .await;
+ cx.assert(indoc! {"
+ The qˇuick
+ brown fox
+ jumps over"})
+ .await;
+ cx.assert(indoc! {"
+ The quick
+ brown fox
+ ˇ"})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_end_of_document(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brownˇ fox
-// jumps over
-// the lazy"},
-// ["d", "shift-g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brownˇ fox
-// jumps over
-// the lazy"},
-// ["d", "shift-g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps over
-// the lˇazy"},
-// ["d", "shift-g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps over
-// ˇ"},
-// ["d", "shift-g"],
-// )
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_end_of_document(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brownˇ fox
+ jumps over
+ the lazy"},
+ ["d", "shift-g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brownˇ fox
+ jumps over
+ the lazy"},
+ ["d", "shift-g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps over
+ the lˇazy"},
+ ["d", "shift-g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps over
+ ˇ"},
+ ["d", "shift-g"],
+ )
+ .await;
+ }
-// #[gpui::test]
-// async fn test_delete_gg(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx)
-// .await
-// .binding(["d", "g", "g"]);
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brownˇ fox
-// jumps over
-// the lazy"},
-// ["d", "g", "g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The quick
-// brown fox
-// jumps over
-// the lˇazy"},
-// ["d", "g", "g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// The qˇuick
-// brown fox
-// jumps over
-// the lazy"},
-// ["d", "g", "g"],
-// )
-// .await;
-// cx.assert_neovim_compatible(
-// indoc! {"
-// ˇ
-// brown fox
-// jumps over
-// the lazy"},
-// ["d", "g", "g"],
-// )
-// .await;
-// }
+ #[gpui::test]
+ async fn test_delete_gg(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx)
+ .await
+ .binding(["d", "g", "g"]);
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brownˇ fox
+ jumps over
+ the lazy"},
+ ["d", "g", "g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The quick
+ brown fox
+ jumps over
+ the lˇazy"},
+ ["d", "g", "g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ The qˇuick
+ brown fox
+ jumps over
+ the lazy"},
+ ["d", "g", "g"],
+ )
+ .await;
+ cx.assert_neovim_compatible(
+ indoc! {"
+ ˇ
+ brown fox
+ jumps over
+ the lazy"},
+ ["d", "g", "g"],
+ )
+ .await;
+ }
-// #[gpui::test]
-// async fn test_cancel_delete_operator(cx: &mut gpui::TestAppContext) {
-// let mut cx = VimTestContext::new(cx, true).await;
-// cx.set_state(
-// indoc! {"
-// The quick brown
-// fox juˇmps over
-// the lazy dog"},
-// Mode::Normal,
-// );
+ #[gpui::test]
+ async fn test_cancel_delete_operator(cx: &mut gpui::TestAppContext) {
+ let mut cx = VimTestContext::new(cx, true).await;
+ cx.set_state(
+ indoc! {"
+ The quick brown
+ fox juˇmps over
+ the lazy dog"},
+ Mode::Normal,
+ );
-// // Canceling operator twice reverts to normal mode with no active operator
-// cx.simulate_keystrokes(["d", "escape", "k"]);
-// assert_eq!(cx.active_operator(), None);
-// assert_eq!(cx.mode(), Mode::Normal);
-// cx.assert_editor_state(indoc! {"
-// The quˇick brown
-// fox jumps over
-// the lazy dog"});
-// }
+ // Canceling operator twice reverts to normal mode with no active operator
+ cx.simulate_keystrokes(["d", "escape", "k"]);
+ assert_eq!(cx.active_operator(), None);
+ assert_eq!(cx.mode(), Mode::Normal);
+ cx.assert_editor_state(indoc! {"
+ The quˇick brown
+ fox jumps over
+ the lazy dog"});
+ }
-// #[gpui::test]
-// async fn test_unbound_command_cancels_pending_operator(cx: &mut gpui::TestAppContext) {
-// let mut cx = VimTestContext::new(cx, true).await;
-// cx.set_state(
-// indoc! {"
-// The quick brown
-// fox juˇmps over
-// the lazy dog"},
-// Mode::Normal,
-// );
+ #[gpui::test]
+ async fn test_unbound_command_cancels_pending_operator(cx: &mut gpui::TestAppContext) {
+ let mut cx = VimTestContext::new(cx, true).await;
+ cx.set_state(
+ indoc! {"
+ The quick brown
+ fox juˇmps over
+ the lazy dog"},
+ Mode::Normal,
+ );
-// // Canceling operator twice reverts to normal mode with no active operator
-// cx.simulate_keystrokes(["d", "y"]);
-// assert_eq!(cx.active_operator(), None);
-// assert_eq!(cx.mode(), Mode::Normal);
-// }
+ // Canceling operator twice reverts to normal mode with no active operator
+ cx.simulate_keystrokes(["d", "y"]);
+ assert_eq!(cx.active_operator(), None);
+ assert_eq!(cx.mode(), Mode::Normal);
+ }
-// #[gpui::test]
-// async fn test_delete_with_counts(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.set_shared_state(indoc! {"
-// The ˇquick brown
-// fox jumps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["d", "2", "d"]).await;
-// cx.assert_shared_state(indoc! {"
-// the ˇlazy dog"})
-// .await;
+ #[gpui::test]
+ async fn test_delete_with_counts(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ cx.set_shared_state(indoc! {"
+ The ˇquick brown
+ fox jumps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["d", "2", "d"]).await;
+ cx.assert_shared_state(indoc! {"
+ the ˇlazy dog"})
+ .await;
-// cx.set_shared_state(indoc! {"
-// The ˇquick brown
-// fox jumps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["2", "d", "d"]).await;
-// cx.assert_shared_state(indoc! {"
-// the ˇlazy dog"})
-// .await;
+ cx.set_shared_state(indoc! {"
+ The ˇquick brown
+ fox jumps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["2", "d", "d"]).await;
+ cx.assert_shared_state(indoc! {"
+ the ˇlazy dog"})
+ .await;
-// cx.set_shared_state(indoc! {"
-// The ˇquick brown
-// fox jumps over
-// the moon,
-// a star, and
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["2", "d", "2", "d"]).await;
-// cx.assert_shared_state(indoc! {"
-// the ˇlazy dog"})
-// .await;
-// }
-// }
+ cx.set_shared_state(indoc! {"
+ The ˇquick brown
+ fox jumps over
+ the moon,
+ a star, and
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["2", "d", "2", "d"]).await;
+ cx.assert_shared_state(indoc! {"
+ the ˇlazy dog"})
+ .await;
+ }
+}
@@ -173,106 +173,106 @@ fn find_number(
}
}
-// #[cfg(test)]
-// mod test {
-// use indoc::indoc;
+#[cfg(test)]
+mod test {
+ use indoc::indoc;
-// use crate::test::NeovimBackedTestContext;
+ use crate::test::NeovimBackedTestContext;
-// #[gpui::test]
-// async fn test_increment(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
+ #[gpui::test]
+ async fn test_increment(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.set_shared_state(indoc! {"
-// 1ˇ2
-// "})
-// .await;
+ cx.set_shared_state(indoc! {"
+ 1ˇ2
+ "})
+ .await;
-// cx.simulate_shared_keystrokes(["ctrl-a"]).await;
-// cx.assert_shared_state(indoc! {"
-// 1ˇ3
-// "})
-// .await;
-// cx.simulate_shared_keystrokes(["ctrl-x"]).await;
-// cx.assert_shared_state(indoc! {"
-// 1ˇ2
-// "})
-// .await;
+ cx.simulate_shared_keystrokes(["ctrl-a"]).await;
+ cx.assert_shared_state(indoc! {"
+ 1ˇ3
+ "})
+ .await;
+ cx.simulate_shared_keystrokes(["ctrl-x"]).await;
+ cx.assert_shared_state(indoc! {"
+ 1ˇ2
+ "})
+ .await;
-// cx.simulate_shared_keystrokes(["9", "9", "ctrl-a"]).await;
-// cx.assert_shared_state(indoc! {"
-// 11ˇ1
-// "})
-// .await;
-// cx.simulate_shared_keystrokes(["1", "1", "1", "ctrl-x"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// ˇ0
-// "})
-// .await;
-// cx.simulate_shared_keystrokes(["."]).await;
-// cx.assert_shared_state(indoc! {"
-// -11ˇ1
-// "})
-// .await;
-// }
+ cx.simulate_shared_keystrokes(["9", "9", "ctrl-a"]).await;
+ cx.assert_shared_state(indoc! {"
+ 11ˇ1
+ "})
+ .await;
+ cx.simulate_shared_keystrokes(["1", "1", "1", "ctrl-x"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ ˇ0
+ "})
+ .await;
+ cx.simulate_shared_keystrokes(["."]).await;
+ cx.assert_shared_state(indoc! {"
+ -11ˇ1
+ "})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_increment_radix(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
+ #[gpui::test]
+ async fn test_increment_radix(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-a"], " total: 0x10ˇ0")
-// .await;
-// cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-x"], " total: 0xfˇe")
-// .await;
-// cx.assert_matches_neovim("ˇ total: 0xFF", ["ctrl-x"], " total: 0xFˇE")
-// .await;
-// cx.assert_matches_neovim("(ˇ0b10f)", ["ctrl-a"], "(0b1ˇ1f)")
-// .await;
-// cx.assert_matches_neovim("ˇ-1", ["ctrl-a"], "ˇ0").await;
-// cx.assert_matches_neovim("banˇana", ["ctrl-a"], "banˇana")
-// .await;
-// }
+ cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-a"], " total: 0x10ˇ0")
+ .await;
+ cx.assert_matches_neovim("ˇ total: 0xff", ["ctrl-x"], " total: 0xfˇe")
+ .await;
+ cx.assert_matches_neovim("ˇ total: 0xFF", ["ctrl-x"], " total: 0xFˇE")
+ .await;
+ cx.assert_matches_neovim("(ˇ0b10f)", ["ctrl-a"], "(0b1ˇ1f)")
+ .await;
+ cx.assert_matches_neovim("ˇ-1", ["ctrl-a"], "ˇ0").await;
+ cx.assert_matches_neovim("banˇana", ["ctrl-a"], "banˇana")
+ .await;
+ }
-// #[gpui::test]
-// async fn test_increment_steps(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
+ #[gpui::test]
+ async fn test_increment_steps(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.set_shared_state(indoc! {"
-// ˇ1
-// 1
-// 1 2
-// 1
-// 1"})
-// .await;
+ cx.set_shared_state(indoc! {"
+ ˇ1
+ 1
+ 1 2
+ 1
+ 1"})
+ .await;
-// cx.simulate_shared_keystrokes(["j", "v", "shift-g", "g", "ctrl-a"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// 1
-// ˇ2
-// 3 2
-// 4
-// 5"})
-// .await;
+ cx.simulate_shared_keystrokes(["j", "v", "shift-g", "g", "ctrl-a"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ 1
+ ˇ2
+ 3 2
+ 4
+ 5"})
+ .await;
-// cx.simulate_shared_keystrokes(["shift-g", "ctrl-v", "g", "g"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// «1ˇ»
-// «2ˇ»
-// «3ˇ» 2
-// «4ˇ»
-// «5ˇ»"})
-// .await;
+ cx.simulate_shared_keystrokes(["shift-g", "ctrl-v", "g", "g"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ «1ˇ»
+ «2ˇ»
+ «3ˇ» 2
+ «4ˇ»
+ «5ˇ»"})
+ .await;
-// cx.simulate_shared_keystrokes(["g", "ctrl-x"]).await;
-// cx.assert_shared_state(indoc! {"
-// ˇ0
-// 0
-// 0 2
-// 0
-// 0"})
-// .await;
-// }
-// }
+ cx.simulate_shared_keystrokes(["g", "ctrl-x"]).await;
+ cx.assert_shared_state(indoc! {"
+ ˇ0
+ 0
+ 0 2
+ 0
+ 0"})
+ .await;
+ }
+}
@@ -197,280 +197,280 @@ fn paste(_: &mut Workspace, action: &Paste, cx: &mut ViewContext<Workspace>) {
});
}
-// #[cfg(test)]
-// mod test {
-// use crate::{
-// state::Mode,
-// test::{NeovimBackedTestContext, VimTestContext},
-// };
-// use indoc::indoc;
-
-// #[gpui::test]
-// async fn test_paste(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// // single line
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox ˇjumps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["v", "w", "y"]).await;
-// cx.assert_shared_clipboard("jumps o").await;
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox jumps oveˇr
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystroke("p").await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// fox jumps overjumps ˇo
-// the lazy dog"})
-// .await;
-
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox jumps oveˇr
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystroke("shift-p").await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// fox jumps ovejumps ˇor
-// the lazy dog"})
-// .await;
-
-// // line mode
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox juˇmps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["d", "d"]).await;
-// cx.assert_shared_clipboard("fox jumps over\n").await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// the laˇzy dog"})
-// .await;
-// cx.simulate_shared_keystroke("p").await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// the lazy dog
-// ˇfox jumps over"})
-// .await;
-// cx.simulate_shared_keystrokes(["k", "shift-p"]).await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// ˇfox jumps over
-// the lazy dog
-// fox jumps over"})
-// .await;
-
-// // multiline, cursor to first character of pasted text.
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox jumps ˇover
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["v", "j", "y"]).await;
-// cx.assert_shared_clipboard("over\nthe lazy do").await;
-
-// cx.simulate_shared_keystroke("p").await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// fox jumps oˇover
-// the lazy dover
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["u", "shift-p"]).await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// fox jumps ˇover
-// the lazy doover
-// the lazy dog"})
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_paste_visual(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-
-// // copy in visual mode
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox jˇumps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["v", "i", "w", "y"]).await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// fox ˇjumps over
-// the lazy dog"})
-// .await;
-// // paste in visual mode
-// cx.simulate_shared_keystrokes(["w", "v", "i", "w", "p"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// fox jumps jumpˇs
-// the lazy dog"})
-// .await;
-// cx.assert_shared_clipboard("over").await;
-// // paste in visual line mode
-// cx.simulate_shared_keystrokes(["up", "shift-v", "shift-p"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// ˇover
-// fox jumps jumps
-// the lazy dog"})
-// .await;
-// cx.assert_shared_clipboard("over").await;
-// // paste in visual block mode
-// cx.simulate_shared_keystrokes(["ctrl-v", "down", "down", "p"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// oveˇrver
-// overox jumps jumps
-// overhe lazy dog"})
-// .await;
-
-// // copy in visual line mode
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox juˇmps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["shift-v", "d"]).await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// the laˇzy dog"})
-// .await;
-// // paste in visual mode
-// cx.simulate_shared_keystrokes(["v", "i", "w", "p"]).await;
-// cx.assert_shared_state(
-// &indoc! {"
-// The quick brown
-// the_
-// ˇfox jumps over
-// _dog"}
-// .replace("_", " "), // Hack for trailing whitespace
-// )
-// .await;
-// cx.assert_shared_clipboard("lazy").await;
-// cx.set_shared_state(indoc! {"
-// The quick brown
-// fox juˇmps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["shift-v", "d"]).await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// the laˇzy dog"})
-// .await;
-// // paste in visual line mode
-// cx.simulate_shared_keystrokes(["k", "shift-v", "p"]).await;
-// cx.assert_shared_state(indoc! {"
-// ˇfox jumps over
-// the lazy dog"})
-// .await;
-// cx.assert_shared_clipboard("The quick brown\n").await;
-// }
-
-// #[gpui::test]
-// async fn test_paste_visual_block(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
-// // copy in visual block mode
-// cx.set_shared_state(indoc! {"
-// The ˇquick brown
-// fox jumps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["ctrl-v", "2", "j", "y"])
-// .await;
-// cx.assert_shared_clipboard("q\nj\nl").await;
-// cx.simulate_shared_keystrokes(["p"]).await;
-// cx.assert_shared_state(indoc! {"
-// The qˇquick brown
-// fox jjumps over
-// the llazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["v", "i", "w", "shift-p"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// The ˇq brown
-// fox jjjumps over
-// the lllazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["v", "i", "w", "shift-p"])
-// .await;
-
-// cx.set_shared_state(indoc! {"
-// The ˇquick brown
-// fox jumps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["ctrl-v", "j", "y"]).await;
-// cx.assert_shared_clipboard("q\nj").await;
-// cx.simulate_shared_keystrokes(["l", "ctrl-v", "2", "j", "shift-p"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// The qˇqick brown
-// fox jjmps over
-// the lzy dog"})
-// .await;
-
-// cx.simulate_shared_keystrokes(["shift-v", "p"]).await;
-// cx.assert_shared_state(indoc! {"
-// ˇq
-// j
-// fox jjmps over
-// the lzy dog"})
-// .await;
-// }
-
-// #[gpui::test]
-// async fn test_paste_indent(cx: &mut gpui::TestAppContext) {
-// let mut cx = VimTestContext::new_typescript(cx).await;
-
-// cx.set_state(
-// indoc! {"
-// class A {ˇ
-// }
-// "},
-// Mode::Normal,
-// );
-// cx.simulate_keystrokes(["o", "a", "(", ")", "{", "escape"]);
-// cx.assert_state(
-// indoc! {"
-// class A {
-// a()ˇ{}
-// }
-// "},
-// Mode::Normal,
-// );
-// // cursor goes to the first non-blank character in the line;
-// cx.simulate_keystrokes(["y", "y", "p"]);
-// cx.assert_state(
-// indoc! {"
-// class A {
-// a(){}
-// ˇa(){}
-// }
-// "},
-// Mode::Normal,
-// );
-// // indentation is preserved when pasting
-// cx.simulate_keystrokes(["u", "shift-v", "up", "y", "shift-p"]);
-// cx.assert_state(
-// indoc! {"
-// ˇclass A {
-// a(){}
-// class A {
-// a(){}
-// }
-// "},
-// Mode::Normal,
-// );
-// }
-// }
+#[cfg(test)]
+mod test {
+ use crate::{
+ state::Mode,
+ test::{NeovimBackedTestContext, VimTestContext},
+ };
+ use indoc::indoc;
+
+ #[gpui::test]
+ async fn test_paste(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ // single line
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox ˇjumps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["v", "w", "y"]).await;
+ cx.assert_shared_clipboard("jumps o").await;
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox jumps oveˇr
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystroke("p").await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ fox jumps overjumps ˇo
+ the lazy dog"})
+ .await;
+
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox jumps oveˇr
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystroke("shift-p").await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ fox jumps ovejumps ˇor
+ the lazy dog"})
+ .await;
+
+ // line mode
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox juˇmps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["d", "d"]).await;
+ cx.assert_shared_clipboard("fox jumps over\n").await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ the laˇzy dog"})
+ .await;
+ cx.simulate_shared_keystroke("p").await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ the lazy dog
+ ˇfox jumps over"})
+ .await;
+ cx.simulate_shared_keystrokes(["k", "shift-p"]).await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ ˇfox jumps over
+ the lazy dog
+ fox jumps over"})
+ .await;
+
+ // multiline, cursor to first character of pasted text.
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox jumps ˇover
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["v", "j", "y"]).await;
+ cx.assert_shared_clipboard("over\nthe lazy do").await;
+
+ cx.simulate_shared_keystroke("p").await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ fox jumps oˇover
+ the lazy dover
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["u", "shift-p"]).await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ fox jumps ˇover
+ the lazy doover
+ the lazy dog"})
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_paste_visual(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+
+ // copy in visual mode
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox jˇumps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["v", "i", "w", "y"]).await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ fox ˇjumps over
+ the lazy dog"})
+ .await;
+ // paste in visual mode
+ cx.simulate_shared_keystrokes(["w", "v", "i", "w", "p"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ fox jumps jumpˇs
+ the lazy dog"})
+ .await;
+ cx.assert_shared_clipboard("over").await;
+ // paste in visual line mode
+ cx.simulate_shared_keystrokes(["up", "shift-v", "shift-p"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ ˇover
+ fox jumps jumps
+ the lazy dog"})
+ .await;
+ cx.assert_shared_clipboard("over").await;
+ // paste in visual block mode
+ cx.simulate_shared_keystrokes(["ctrl-v", "down", "down", "p"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ oveˇrver
+ overox jumps jumps
+ overhe lazy dog"})
+ .await;
+
+ // copy in visual line mode
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox juˇmps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["shift-v", "d"]).await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ the laˇzy dog"})
+ .await;
+ // paste in visual mode
+ cx.simulate_shared_keystrokes(["v", "i", "w", "p"]).await;
+ cx.assert_shared_state(
+ &indoc! {"
+ The quick brown
+ the_
+ ˇfox jumps over
+ _dog"}
+ .replace("_", " "), // Hack for trailing whitespace
+ )
+ .await;
+ cx.assert_shared_clipboard("lazy").await;
+ cx.set_shared_state(indoc! {"
+ The quick brown
+ fox juˇmps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["shift-v", "d"]).await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ the laˇzy dog"})
+ .await;
+ // paste in visual line mode
+ cx.simulate_shared_keystrokes(["k", "shift-v", "p"]).await;
+ cx.assert_shared_state(indoc! {"
+ ˇfox jumps over
+ the lazy dog"})
+ .await;
+ cx.assert_shared_clipboard("The quick brown\n").await;
+ }
+
+ #[gpui::test]
+ async fn test_paste_visual_block(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
+ // copy in visual block mode
+ cx.set_shared_state(indoc! {"
+ The ˇquick brown
+ fox jumps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["ctrl-v", "2", "j", "y"])
+ .await;
+ cx.assert_shared_clipboard("q\nj\nl").await;
+ cx.simulate_shared_keystrokes(["p"]).await;
+ cx.assert_shared_state(indoc! {"
+ The qˇquick brown
+ fox jjumps over
+ the llazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["v", "i", "w", "shift-p"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ The ˇq brown
+ fox jjjumps over
+ the lllazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["v", "i", "w", "shift-p"])
+ .await;
+
+ cx.set_shared_state(indoc! {"
+ The ˇquick brown
+ fox jumps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["ctrl-v", "j", "y"]).await;
+ cx.assert_shared_clipboard("q\nj").await;
+ cx.simulate_shared_keystrokes(["l", "ctrl-v", "2", "j", "shift-p"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ The qˇqick brown
+ fox jjmps over
+ the lzy dog"})
+ .await;
+
+ cx.simulate_shared_keystrokes(["shift-v", "p"]).await;
+ cx.assert_shared_state(indoc! {"
+ ˇq
+ j
+ fox jjmps over
+ the lzy dog"})
+ .await;
+ }
+
+ #[gpui::test]
+ async fn test_paste_indent(cx: &mut gpui::TestAppContext) {
+ let mut cx = VimTestContext::new_typescript(cx).await;
+
+ cx.set_state(
+ indoc! {"
+ class A {ˇ
+ }
+ "},
+ Mode::Normal,
+ );
+ cx.simulate_keystrokes(["o", "a", "(", ")", "{", "escape"]);
+ cx.assert_state(
+ indoc! {"
+ class A {
+ a()ˇ{}
+ }
+ "},
+ Mode::Normal,
+ );
+ // cursor goes to the first non-blank character in the line;
+ cx.simulate_keystrokes(["y", "y", "p"]);
+ cx.assert_state(
+ indoc! {"
+ class A {
+ a(){}
+ ˇa(){}
+ }
+ "},
+ Mode::Normal,
+ );
+ // indentation is preserved when pasting
+ cx.simulate_keystrokes(["u", "shift-v", "up", "y", "shift-p"]);
+ cx.assert_state(
+ indoc! {"
+ ˇclass A {
+ a(){}
+ class A {
+ a(){}
+ }
+ "},
+ Mode::Normal,
+ );
+ }
+}
@@ -81,196 +81,196 @@ pub fn substitute(vim: &mut Vim, count: Option<usize>, line_mode: bool, cx: &mut
vim.switch_mode(Mode::Insert, true, cx);
}
-// #[cfg(test)]
-// mod test {
-// use crate::{
-// state::Mode,
-// test::{NeovimBackedTestContext, VimTestContext},
-// };
-// use indoc::indoc;
+#[cfg(test)]
+mod test {
+ use crate::{
+ state::Mode,
+ test::{NeovimBackedTestContext, VimTestContext},
+ };
+ use indoc::indoc;
-// #[gpui::test]
-// async fn test_substitute(cx: &mut gpui::TestAppContext) {
-// let mut cx = VimTestContext::new(cx, true).await;
+ #[gpui::test]
+ async fn test_substitute(cx: &mut gpui::TestAppContext) {
+ let mut cx = VimTestContext::new(cx, true).await;
-// // supports a single cursor
-// cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
-// cx.simulate_keystrokes(["s", "x"]);
-// cx.assert_editor_state("xˇbc\n");
+ // supports a single cursor
+ cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
+ cx.simulate_keystrokes(["s", "x"]);
+ cx.assert_editor_state("xˇbc\n");
-// // supports a selection
-// cx.set_state(indoc! {"a«bcˇ»\n"}, Mode::Visual);
-// cx.assert_editor_state("a«bcˇ»\n");
-// cx.simulate_keystrokes(["s", "x"]);
-// cx.assert_editor_state("axˇ\n");
+ // supports a selection
+ cx.set_state(indoc! {"a«bcˇ»\n"}, Mode::Visual);
+ cx.assert_editor_state("a«bcˇ»\n");
+ cx.simulate_keystrokes(["s", "x"]);
+ cx.assert_editor_state("axˇ\n");
-// // supports counts
-// cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
-// cx.simulate_keystrokes(["2", "s", "x"]);
-// cx.assert_editor_state("xˇc\n");
+ // supports counts
+ cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
+ cx.simulate_keystrokes(["2", "s", "x"]);
+ cx.assert_editor_state("xˇc\n");
-// // supports multiple cursors
-// cx.set_state(indoc! {"a«bcˇ»deˇffg\n"}, Mode::Normal);
-// cx.simulate_keystrokes(["2", "s", "x"]);
-// cx.assert_editor_state("axˇdexˇg\n");
+ // supports multiple cursors
+ cx.set_state(indoc! {"a«bcˇ»deˇffg\n"}, Mode::Normal);
+ cx.simulate_keystrokes(["2", "s", "x"]);
+ cx.assert_editor_state("axˇdexˇg\n");
-// // does not read beyond end of line
-// cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
-// cx.simulate_keystrokes(["5", "s", "x"]);
-// cx.assert_editor_state("xˇ\n");
+ // does not read beyond end of line
+ cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
+ cx.simulate_keystrokes(["5", "s", "x"]);
+ cx.assert_editor_state("xˇ\n");
-// // it handles multibyte characters
-// cx.set_state(indoc! {"ˇcàfé\n"}, Mode::Normal);
-// cx.simulate_keystrokes(["4", "s"]);
-// cx.assert_editor_state("ˇ\n");
+ // it handles multibyte characters
+ cx.set_state(indoc! {"ˇcàfé\n"}, Mode::Normal);
+ cx.simulate_keystrokes(["4", "s"]);
+ cx.assert_editor_state("ˇ\n");
-// // should transactionally undo selection changes
-// cx.simulate_keystrokes(["escape", "u"]);
-// cx.assert_editor_state("ˇcàfé\n");
+ // should transactionally undo selection changes
+ cx.simulate_keystrokes(["escape", "u"]);
+ cx.assert_editor_state("ˇcàfé\n");
-// // it handles visual line mode
-// cx.set_state(
-// indoc! {"
-// alpha
-// beˇta
-// gamma"},
-// Mode::Normal,
-// );
-// cx.simulate_keystrokes(["shift-v", "s"]);
-// cx.assert_editor_state(indoc! {"
-// alpha
-// ˇ
-// gamma"});
-// }
+ // it handles visual line mode
+ cx.set_state(
+ indoc! {"
+ alpha
+ beˇta
+ gamma"},
+ Mode::Normal,
+ );
+ cx.simulate_keystrokes(["shift-v", "s"]);
+ cx.assert_editor_state(indoc! {"
+ alpha
+ ˇ
+ gamma"});
+ }
-// #[gpui::test]
-// async fn test_visual_change(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
+ #[gpui::test]
+ async fn test_visual_change(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
-// cx.set_shared_state("The quick ˇbrown").await;
-// cx.simulate_shared_keystrokes(["v", "w", "c"]).await;
-// cx.assert_shared_state("The quick ˇ").await;
+ cx.set_shared_state("The quick ˇbrown").await;
+ cx.simulate_shared_keystrokes(["v", "w", "c"]).await;
+ cx.assert_shared_state("The quick ˇ").await;
-// cx.set_shared_state(indoc! {"
-// The ˇquick brown
-// fox jumps over
-// the lazy dog"})
-// .await;
-// cx.simulate_shared_keystrokes(["v", "w", "j", "c"]).await;
-// cx.assert_shared_state(indoc! {"
-// The ˇver
-// the lazy dog"})
-// .await;
+ cx.set_shared_state(indoc! {"
+ The ˇquick brown
+ fox jumps over
+ the lazy dog"})
+ .await;
+ cx.simulate_shared_keystrokes(["v", "w", "j", "c"]).await;
+ cx.assert_shared_state(indoc! {"
+ The ˇver
+ the lazy dog"})
+ .await;
-// let cases = cx.each_marked_position(indoc! {"
-// The ˇquick brown
-// fox jumps ˇover
-// the ˇlazy dog"});
-// for initial_state in cases {
-// cx.assert_neovim_compatible(&initial_state, ["v", "w", "j", "c"])
-// .await;
-// cx.assert_neovim_compatible(&initial_state, ["v", "w", "k", "c"])
-// .await;
-// }
-// }
+ let cases = cx.each_marked_position(indoc! {"
+ The ˇquick brown
+ fox jumps ˇover
+ the ˇlazy dog"});
+ for initial_state in cases {
+ cx.assert_neovim_compatible(&initial_state, ["v", "w", "j", "c"])
+ .await;
+ cx.assert_neovim_compatible(&initial_state, ["v", "w", "k", "c"])
+ .await;
+ }
+ }
-// #[gpui::test]
-// async fn test_visual_line_change(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx)
-// .await
-// .binding(["shift-v", "c"]);
-// cx.assert(indoc! {"
-// The quˇick brown
-// fox jumps over
-// the lazy dog"})
-// .await;
-// // Test pasting code copied on change
-// cx.simulate_shared_keystrokes(["escape", "j", "p"]).await;
-// cx.assert_state_matches().await;
+ #[gpui::test]
+ async fn test_visual_line_change(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx)
+ .await
+ .binding(["shift-v", "c"]);
+ cx.assert(indoc! {"
+ The quˇick brown
+ fox jumps over
+ the lazy dog"})
+ .await;
+ // Test pasting code copied on change
+ cx.simulate_shared_keystrokes(["escape", "j", "p"]).await;
+ cx.assert_state_matches().await;
-// cx.assert_all(indoc! {"
-// The quick brown
-// fox juˇmps over
-// the laˇzy dog"})
-// .await;
-// let mut cx = cx.binding(["shift-v", "j", "c"]);
-// cx.assert(indoc! {"
-// The quˇick brown
-// fox jumps over
-// the lazy dog"})
-// .await;
-// // Test pasting code copied on delete
-// cx.simulate_shared_keystrokes(["escape", "j", "p"]).await;
-// cx.assert_state_matches().await;
+ cx.assert_all(indoc! {"
+ The quick brown
+ fox juˇmps over
+ the laˇzy dog"})
+ .await;
+ let mut cx = cx.binding(["shift-v", "j", "c"]);
+ cx.assert(indoc! {"
+ The quˇick brown
+ fox jumps over
+ the lazy dog"})
+ .await;
+ // Test pasting code copied on delete
+ cx.simulate_shared_keystrokes(["escape", "j", "p"]).await;
+ cx.assert_state_matches().await;
-// cx.assert_all(indoc! {"
-// The quick brown
-// fox juˇmps over
-// the laˇzy dog"})
-// .await;
-// }
+ cx.assert_all(indoc! {"
+ The quick brown
+ fox juˇmps over
+ the laˇzy dog"})
+ .await;
+ }
-// #[gpui::test]
-// async fn test_substitute_line(cx: &mut gpui::TestAppContext) {
-// let mut cx = NeovimBackedTestContext::new(cx).await;
+ #[gpui::test]
+ async fn test_substitute_line(cx: &mut gpui::TestAppContext) {
+ let mut cx = NeovimBackedTestContext::new(cx).await;
-// let initial_state = indoc! {"
-// The quick brown
-// fox juˇmps over
-// the lazy dog
-// "};
+ let initial_state = indoc! {"
+ The quick brown
+ fox juˇmps over
+ the lazy dog
+ "};
-// // normal mode
-// cx.set_shared_state(initial_state).await;
-// cx.simulate_shared_keystrokes(["shift-s", "o"]).await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// oˇ
-// the lazy dog
-// "})
-// .await;
+ // normal mode
+ cx.set_shared_state(initial_state).await;
+ cx.simulate_shared_keystrokes(["shift-s", "o"]).await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ oˇ
+ the lazy dog
+ "})
+ .await;
-// // visual mode
-// cx.set_shared_state(initial_state).await;
-// cx.simulate_shared_keystrokes(["v", "k", "shift-s", "o"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// oˇ
-// the lazy dog
-// "})
-// .await;
+ // visual mode
+ cx.set_shared_state(initial_state).await;
+ cx.simulate_shared_keystrokes(["v", "k", "shift-s", "o"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ oˇ
+ the lazy dog
+ "})
+ .await;
-// // visual block mode
-// cx.set_shared_state(initial_state).await;
-// cx.simulate_shared_keystrokes(["ctrl-v", "j", "shift-s", "o"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// oˇ
-// "})
-// .await;
+ // visual block mode
+ cx.set_shared_state(initial_state).await;
+ cx.simulate_shared_keystrokes(["ctrl-v", "j", "shift-s", "o"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ oˇ
+ "})
+ .await;
-// // visual mode including newline
-// cx.set_shared_state(initial_state).await;
-// cx.simulate_shared_keystrokes(["v", "$", "shift-s", "o"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// oˇ
-// the lazy dog
-// "})
-// .await;
+ // visual mode including newline
+ cx.set_shared_state(initial_state).await;
+ cx.simulate_shared_keystrokes(["v", "$", "shift-s", "o"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ oˇ
+ the lazy dog
+ "})
+ .await;
-// // indentation
-// cx.set_neovim_option("shiftwidth=4").await;
-// cx.set_shared_state(initial_state).await;
-// cx.simulate_shared_keystrokes([">", ">", "shift-s", "o"])
-// .await;
-// cx.assert_shared_state(indoc! {"
-// The quick brown
-// oˇ
-// the lazy dog
-// "})
-// .await;
-// }
-// }
+ // indentation
+ cx.set_neovim_option("shiftwidth=4").await;
+ cx.set_shared_state(initial_state).await;
+ cx.simulate_shared_keystrokes([">", ">", "shift-s", "o"])
+ .await;
+ cx.assert_shared_state(indoc! {"
+ The quick brown
+ oˇ
+ the lazy dog
+ "})
+ .await;
+ }
+}
@@ -140,6 +140,8 @@ pub fn observe_keystrokes(cx: &mut WindowContext) {
if action.name().starts_with("vim::") {
return;
}
+ } else if cx.has_pending_keystrokes() {
+ return;
}
Vim::update(cx, |vim, cx| match vim.active_operator() {