diff options
author | Michael Davis | 2022-11-14 00:45:52 +0000 |
---|---|---|
committer | GitHub | 2022-11-14 00:45:52 +0000 |
commit | c74b97447f7a84f7728ce41c796f435371563a68 (patch) | |
tree | ae5af2ac3b6007341cc3238faab68d204ad631b8 /helix-term/tests | |
parent | fd585c1ee4ae0ac541f99b5e69a40833f5e3246d (diff) |
Fix range offsets for multiple shell insertions (#4619)
d6323b7cbc21a9d3ba29738c76581dad93f9f415 introduced a regression for
shell commands like `|`, `!`, and `<A-!>` which caused the new
selections to be incorrect. This caused a panic when piping (`|`)
would cause the new range to extend past the document end.
The paste version of this bug was fixed in
48a3965ab43718ce2a49724cbcc294b04c328b81.
This change also inherits the direction of the new range from the old
range and adds integration tests to ensure that the behavior isn't
broken in the future.
Diffstat (limited to 'helix-term/tests')
-rw-r--r-- | helix-term/tests/test/commands.rs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index e78e6c9f..114bf222 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -215,3 +215,71 @@ async fn test_multi_selection_paste() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn test_multi_selection_shell_commands() -> anyhow::Result<()> { + // pipe + test(( + platform_line(indoc! {"\ + #[|lorem]# + #(|ipsum)# + #(|dolor)# + "}) + .as_str(), + "|echo foo<ret>", + platform_line(indoc! {"\ + #[|foo + ]# + #(|foo + )# + #(|foo + )# + "}) + .as_str(), + )) + .await?; + + // insert-output + test(( + platform_line(indoc! {"\ + #[|lorem]# + #(|ipsum)# + #(|dolor)# + "}) + .as_str(), + "!echo foo<ret>", + platform_line(indoc! {"\ + #[|foo + ]#lorem + #(|foo + )#ipsum + #(|foo + )#dolor + "}) + .as_str(), + )) + .await?; + + // append-output + test(( + platform_line(indoc! {"\ + #[|lorem]# + #(|ipsum)# + #(|dolor)# + "}) + .as_str(), + "<A-!>echo foo<ret>", + platform_line(indoc! {"\ + lorem#[|foo + ]# + ipsum#(|foo + )# + dolor#(|foo + )# + "}) + .as_str(), + )) + .await?; + + Ok(()) +} |