From 370be363f1c7b3c43008d1f5aa49a2ea05b2d4f1 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Mon, 13 Apr 2026 08:53:37 -0700 Subject: [PATCH] Wrap status reset timestamps in narrow layouts (#17481) Addresses #17453 Problem: /status rate-limit reset timestamps can be truncated in narrow layouts, leaving users with partial times or dates. Solution: Let narrow rate-limit rows drop the fixed progress bar to preserve the percent summary, and wrap reset timestamps onto continuation lines instead of truncating them. --- codex-rs/tui/src/status/card.rs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/codex-rs/tui/src/status/card.rs b/codex-rs/tui/src/status/card.rs index 340f933689..20b4c6ed8d 100644 --- a/codex-rs/tui/src/status/card.rs +++ b/codex-rs/tui/src/status/card.rs @@ -457,11 +457,21 @@ impl StatusHistoryCell { resets_at, } => { let percent_remaining = (100.0 - percent_used).clamp(0.0, 100.0); - let value_spans = vec![ + let summary = format_status_limit_summary(percent_remaining); + let full_value_spans = vec![ Span::from(render_status_limit_progress_bar(percent_remaining)), Span::from(" "), - Span::from(format_status_limit_summary(percent_remaining)), + Span::from(summary.clone()), ]; + // On narrow terminals, keep the percentage visible rather than + // letting the fixed-width progress bar crowd out the reset time. + let value_spans = if line_display_width(&Line::from(full_value_spans.clone())) + <= formatter.value_width(available_inner_width) + { + full_value_spans + } else { + vec![Span::from(summary)] + }; let base_spans = formatter.full_spans(row.label.as_str(), value_spans); let base_line = Line::from(base_spans.clone()); @@ -477,7 +487,21 @@ impl StatusHistoryCell { lines.push(Line::from(inline_spans)); } else { lines.push(base_line); - lines.push(formatter.continuation(vec![resets_span])); + let reset_text = format!("(resets {resets_at})"); + let reset_width = formatter.value_width(available_inner_width).max(1); + let wrap_options = + textwrap::Options::new(reset_width).break_words(false); + // Reset timestamps are the actionable part of this row, so wrap them + // onto continuation lines instead of truncating partial times/dates. + lines.extend( + textwrap::wrap(reset_text.as_str(), wrap_options) + .into_iter() + .map(|wrapped| { + formatter.continuation(vec![ + Span::from(wrapped.into_owned()).dim(), + ]) + }), + ); } } else { lines.push(base_line);