Skip to content

Commit

Permalink
minor: Remove redundant condition in shell pipe trimming
Browse files Browse the repository at this point in the history
`output.ends_with('\n')` implies `!output.is_empty()`

Connects #11183
  • Loading branch information
the-mikedavis committed Dec 22, 2024
1 parent ac4c017 commit 4f63a46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6029,7 +6029,7 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) {
let input = range.slice(text);
match shell_impl(shell, cmd, pipe.then(|| input.into())) {
Ok(mut output) => {
if !input.ends_with("\n") && !output.is_empty() && output.ends_with('\n') {
if !input.ends_with("\n") && output.ends_with('\n') {
output.pop();
if output.ends_with('\r') {
output.pop();
Expand Down

0 comments on commit 4f63a46

Please sign in to comment.