diff options
author | TornaxO7 | 2023-12-06 15:19:54 +0000 |
---|---|---|
committer | GitHub | 2023-12-06 15:19:54 +0000 |
commit | b81aacc5e1332bb01043a18e55dd9e9543711ec6 (patch) | |
tree | 7c59110f6d878b7a6f3be0dc597962cb1bc6d928 /helix-term/tests/test | |
parent | c3cb1795bfd2bfe1c01badd71ac101b0c8fdd379 (diff) |
Join empty lines with only one space in `join_selections` (#8989)
* fix: #8977
fixes the issue that lines with only spaces are getting
joined as well
* reverting some renamings
* improve empty line check
* adding integration test
* reverting code block
* fix conditon check for line end
* applying suggested style
Diffstat (limited to 'helix-term/tests/test')
-rw-r--r-- | helix-term/tests/test/commands.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index b3e13551..e52b142c 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -480,3 +480,49 @@ fn bar() {#(\n|)#\ Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn test_join_selections() -> anyhow::Result<()> { + // normal join + test(( + platform_line(indoc! {"\ + #[a|]#bc + def + "}), + "J", + platform_line(indoc! {"\ + #[a|]#bc def + "}), + )) + .await?; + + // join with empty line + test(( + platform_line(indoc! {"\ + #[a|]#bc + + def + "}), + "JJ", + platform_line(indoc! {"\ + #[a|]#bc def + "}), + )) + .await?; + + // join with additional space in non-empty line + test(( + platform_line(indoc! {"\ + #[a|]#bc + + def + "}), + "JJ", + platform_line(indoc! {"\ + #[a|]#bc def + "}), + )) + .await?; + + Ok(()) +} |