From 751b3b50ac6e05dc92ff57ff4d519afbb474a7ca Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Wed, 1 Oct 2025 10:42:30 -0700 Subject: [PATCH] Show placeholder for commands with no output (#4509) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - show a dim “(no output)” placeholder when an executed command produces no stdout or stderr so empty runs are visible - update TUI snapshots to include the new placeholder in history renderings ## Testing - cargo test -p codex-tui ------ https://chatgpt.com/codex/tasks/task_i_68dc056c1d5883218fe8d9929e9b1657 --- ...t__tests__interrupt_exec_marks_failed.snap | 1 + codex-rs/tui/src/exec_cell/render.rs | 39 ++++++++++++------- ...both_lines_wrap_with_correct_prefixes.snap | 1 + ...ut_wrap_uses_branch_then_eight_spaces.snap | 1 + ...with_extra_indent_on_subsequent_lines.snap | 1 + ...single_line_command_compact_when_fits.snap | 1 + ...nd_wraps_with_four_space_continuation.snap | 1 + 7 files changed, 30 insertions(+), 15 deletions(-) diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap index 5098b824..59eff20a 100644 --- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap +++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__interrupt_exec_marks_failed.snap @@ -3,3 +3,4 @@ source: tui/src/chatwidget/tests.rs expression: exec_blob --- • Ran sleep 1 + └ (no output) diff --git a/codex-rs/tui/src/exec_cell/render.rs b/codex-rs/tui/src/exec_cell/render.rs index daf59565..19232c86 100644 --- a/codex-rs/tui/src/exec_cell/render.rs +++ b/codex-rs/tui/src/exec_cell/render.rs @@ -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> = 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> = 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), + )); + } } } diff --git a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_both_lines_wrap_with_correct_prefixes.snap b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_both_lines_wrap_with_correct_prefixes.snap index 05500c62..b5d4fac1 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_both_lines_wrap_with_correct_prefixes.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_both_lines_wrap_with_correct_prefixes.snap @@ -6,3 +6,4 @@ expression: rendered │ ough_to_wrap │ second_token_is_also_lon │ … +1 lines + └ (no output) diff --git a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_without_wrap_uses_branch_then_eight_spaces.snap b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_without_wrap_uses_branch_then_eight_spaces.snap index 33644d49..10d87ad9 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_without_wrap_uses_branch_then_eight_spaces.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_without_wrap_uses_branch_then_eight_spaces.snap @@ -4,3 +4,4 @@ expression: rendered --- • Ran echo one │ echo two + └ (no output) diff --git a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_wraps_with_extra_indent_on_subsequent_lines.snap b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_wraps_with_extra_indent_on_subsequent_lines.snap index acd5b64b..e8458cfd 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_wraps_with_extra_indent_on_subsequent_lines.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__multiline_command_wraps_with_extra_indent_on_subsequent_lines.snap @@ -5,3 +5,4 @@ expression: rendered • Ran set -o pipefail │ cargo test │ --all-features --quiet + └ (no output) diff --git a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_compact_when_fits.snap b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_compact_when_fits.snap index b4a79261..23827df9 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_compact_when_fits.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_compact_when_fits.snap @@ -3,3 +3,4 @@ source: tui/src/history_cell.rs expression: rendered --- • Ran echo ok + └ (no output) diff --git a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_wraps_with_four_space_continuation.snap b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_wraps_with_four_space_continuation.snap index 27623ae1..244fd1d7 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_wraps_with_four_space_continuation.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__single_line_command_wraps_with_four_space_continuation.snap @@ -5,3 +5,4 @@ expression: rendered • Ran a_very_long_token_ │ without_spaces_to_ │ force_wrapping + └ (no output)