refactor(commands): trim end of pipe
-like output (#10952)
This commit is contained in:
parent
a75b1cf51e
commit
fd7b1a3e37
2 changed files with 11 additions and 19 deletions
|
@ -5757,6 +5757,7 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
|
||||||
let fragment = range.slice(text);
|
let fragment = range.slice(text);
|
||||||
match shell_impl(shell, cmd, pipe.then(|| fragment.into())) {
|
match shell_impl(shell, cmd, pipe.then(|| fragment.into())) {
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
|
let result = Tendril::from(result.trim_end());
|
||||||
if !pipe {
|
if !pipe {
|
||||||
shell_output = Some(result.clone());
|
shell_output = Some(result.clone());
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,13 +209,10 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> {
|
||||||
"},
|
"},
|
||||||
"|echo foo<ret>",
|
"|echo foo<ret>",
|
||||||
indoc! {"\
|
indoc! {"\
|
||||||
#[|foo\n]#
|
#[|foo]#
|
||||||
|
#(|foo)#
|
||||||
#(|foo\n)#
|
#(|foo)#"
|
||||||
|
},
|
||||||
#(|foo\n)#
|
|
||||||
|
|
||||||
"},
|
|
||||||
))
|
))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
@ -228,12 +225,9 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> {
|
||||||
"},
|
"},
|
||||||
"!echo foo<ret>",
|
"!echo foo<ret>",
|
||||||
indoc! {"\
|
indoc! {"\
|
||||||
#[|foo\n]#
|
#[|foo]#lorem
|
||||||
lorem
|
#(|foo)#ipsum
|
||||||
#(|foo\n)#
|
#(|foo)#dolor
|
||||||
ipsum
|
|
||||||
#(|foo\n)#
|
|
||||||
dolor
|
|
||||||
"},
|
"},
|
||||||
))
|
))
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -247,12 +241,9 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> {
|
||||||
"},
|
"},
|
||||||
"<A-!>echo foo<ret>",
|
"<A-!>echo foo<ret>",
|
||||||
indoc! {"\
|
indoc! {"\
|
||||||
lorem#[|foo\n]#
|
lorem#[|foo]#
|
||||||
|
ipsum#(|foo)#
|
||||||
ipsum#(|foo\n)#
|
dolor#(|foo)#
|
||||||
|
|
||||||
dolor#(|foo\n)#
|
|
||||||
|
|
||||||
"},
|
"},
|
||||||
))
|
))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue