Skip to content
Merged
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
30 changes: 27 additions & 3 deletions codex-rs/tui/src/status/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,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());

Expand All @@ -490,7 +500,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);
Expand Down
Loading