Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(commands): trim end of pipe-like output #10952

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5760,6 +5760,7 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
let fragment = range.slice(text);
match shell_impl(shell, cmd, pipe.then(|| fragment.into())) {
Ok(result) => {
let result = Tendril::from(result.trim_end());
if !pipe {
shell_output = Some(result.clone());
}
Expand Down
29 changes: 10 additions & 19 deletions helix-term/tests/test/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,10 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> {
"},
"|echo foo<ret>",
indoc! {"\
#[|foo\n]#

#(|foo\n)#

#(|foo\n)#

"},
#[|foo]#
#(|foo)#
#(|foo)#"
},
))
.await?;

Expand All @@ -228,12 +225,9 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> {
"},
"!echo foo<ret>",
indoc! {"\
#[|foo\n]#
lorem
#(|foo\n)#
ipsum
#(|foo\n)#
dolor
#[|foo]#lorem
#(|foo)#ipsum
#(|foo)#dolor
"},
))
.await?;
Expand All @@ -247,12 +241,9 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> {
"},
"<A-!>echo foo<ret>",
indoc! {"\
lorem#[|foo\n]#

ipsum#(|foo\n)#

dolor#(|foo\n)#

lorem#[|foo]#
ipsum#(|foo)#
dolor#(|foo)#
"},
))
.await?;
Expand Down
Loading