From 68909dcef46c7b68f1a92cdc7fd04eb89549b6fb Mon Sep 17 00:00:00 2001 From: Graic Date: Wed, 12 Oct 2022 09:34:35 -0400 Subject: Fix append cursor location when selection anchor is at end of document (#4147) --- helix-term/tests/test/movement.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'helix-term/tests/test/movement.rs') diff --git a/helix-term/tests/test/movement.rs b/helix-term/tests/test/movement.rs index e5abb0b0..45aae39e 100644 --- a/helix-term/tests/test/movement.rs +++ b/helix-term/tests/test/movement.rs @@ -86,6 +86,27 @@ async fn cursor_position_newly_opened_file() -> anyhow::Result<()> { Ok(()) } +#[tokio::test] +async fn cursor_position_append_eof() -> anyhow::Result<()> { + // Selection is fowards + test(( + "#[foo|]#", + "abar", + helpers::platform_line("#[foobar|]#\n").as_ref(), + )) + .await?; + + // Selection is backwards + test(( + "#[|foo]#", + "abar", + helpers::platform_line("#[foobar|]#\n").as_ref(), + )) + .await?; + + Ok(()) +} + #[tokio::test] async fn select_mode_tree_sitter_next_function_is_union_of_objects() -> anyhow::Result<()> { test_with_config( -- cgit v1.2.3-70-g09d2