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

pull/11159/head
RoloEdits 4 months ago committed by GitHub
parent a75b1cf51e
commit fd7b1a3e37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5757,6 +5757,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());
}

@ -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?;
@ -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?;
@ -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?;

Loading…
Cancel
Save