Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ source: tui/src/chatwidget/tests.rs
expression: exec_blob
---
• Ran sleep 1
└ (no output)
Comment on lines 5 to +6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo if it's a one-line command with no output, we shouldn't show "(no output)".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's iterate over it.

39 changes: 24 additions & 15 deletions codex-rs/tui/src/exec_cell/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,26 +366,35 @@ impl ExecCell {
include_prefix: false,
},
);
let trimmed_output =
Self::truncate_lines_middle(&raw_output_lines, layout.output_max_lines);

let mut wrapped_output: Vec<Line<'static>> = Vec::new();
let output_wrap_width = layout.output_block.wrap_width(width);
let output_opts =
RtOptions::new(output_wrap_width).word_splitter(WordSplitter::NoHyphenation);
for line in trimmed_output {
push_owned_lines(
&word_wrap_line(&line, output_opts.clone()),
&mut wrapped_output,
);
}

if !wrapped_output.is_empty() {
if raw_output_lines.is_empty() {
lines.extend(prefix_lines(
wrapped_output,
vec![Line::from("(no output)".dim())],
Span::from(layout.output_block.initial_prefix).dim(),
Span::from(layout.output_block.subsequent_prefix),
));
} else {
let trimmed_output =
Self::truncate_lines_middle(&raw_output_lines, layout.output_max_lines);

let mut wrapped_output: Vec<Line<'static>> = Vec::new();
let output_wrap_width = layout.output_block.wrap_width(width);
let output_opts =
RtOptions::new(output_wrap_width).word_splitter(WordSplitter::NoHyphenation);
for line in trimmed_output {
push_owned_lines(
&word_wrap_line(&line, output_opts.clone()),
&mut wrapped_output,
);
}

if !wrapped_output.is_empty() {
lines.extend(prefix_lines(
wrapped_output,
Span::from(layout.output_block.initial_prefix).dim(),
Span::from(layout.output_block.subsequent_prefix),
));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ expression: rendered
│ ough_to_wrap
│ second_token_is_also_lon
│ … +1 lines
└ (no output)
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ expression: rendered
---
• Ran echo one
│ echo two
└ (no output)
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ expression: rendered
• Ran set -o pipefail
│ cargo test
│ --all-features --quiet
└ (no output)
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ source: tui/src/history_cell.rs
expression: rendered
---
• Ran echo ok
└ (no output)
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ expression: rendered
• Ran a_very_long_token_
│ without_spaces_to_
│ force_wrapping
└ (no output)
Loading