diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index e2562f162e..f866b3705b 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -1254,6 +1254,12 @@ impl HistoryCell for SessionHeaderHistoryCell { label_width = label_width ); let reasoning_label = self.reasoning_label(); + let model_value_width = UnicodeWidthStr::width(self.model.as_str()) + + reasoning_label + .map(|reasoning| 1 + UnicodeWidthStr::width(reasoning)) + .unwrap_or_default(); + let speed_value_width = UnicodeWidthStr::width(self.speed_label()); + let hint_column_width = model_value_width.max(speed_value_width) + 3; let model_spans: Vec> = { let mut spans = vec![ Span::from(format!("{model_label} ")).dim(), @@ -1263,7 +1269,7 @@ impl HistoryCell for SessionHeaderHistoryCell { spans.push(Span::from(" ")); spans.push(Span::from(reasoning)); } - spans.push(" ".dim()); + spans.push(" ".repeat(hint_column_width - model_value_width).dim()); spans.push(CHANGE_MODEL_HINT_COMMAND.cyan()); spans.push(CHANGE_MODEL_HINT_EXPLANATION.dim()); spans @@ -1284,7 +1290,7 @@ impl HistoryCell for SessionHeaderHistoryCell { let speed_spans = vec![ Span::from(format!("{speed_label} ")).dim(), Span::styled(self.speed_label(), self.model_style), - " ".dim(), + " ".repeat(hint_column_width - speed_value_width).dim(), CHANGE_SPEED_HINT_COMMAND.cyan(), CHANGE_SPEED_HINT_EXPLANATION.dim(), ]; @@ -3323,6 +3329,7 @@ mod tests { assert!(model_line.contains("/model to change")); assert!(speed_line.contains("Fast")); assert!(speed_line.contains("/fast to change")); + assert_eq!(model_line.find("/model"), speed_line.find("/fast")); } #[test] diff --git a/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snap b/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snap index 894ed4d4f3..1a5ff1593a 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__app__tests__clear_ui_after_long_transcript_fresh_header_only.snap @@ -1,12 +1,12 @@ --- source: tui/src/app.rs -assertion_line: 3452 +assertion_line: 4441 expression: rendered --- ╭─────────────────────────────────────────────╮ │ >_ OpenAI Codex (v) │ │ │ │ model: gpt-test high /model to change │ -│ speed: Standard /fast to change │ +│ speed: Standard /fast to change │ │ directory: /tmp/project │ ╰─────────────────────────────────────────────╯ diff --git a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap index 8f25517140..6b50f008f5 100644 --- a/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap +++ b/codex-rs/tui/src/snapshots/codex_tui__history_cell__tests__session_info_availability_nux_tooltip_snapshot.snap @@ -1,14 +1,14 @@ --- source: tui/src/history_cell.rs -assertion_line: 2608 +assertion_line: 2650 expression: rendered --- -╭───────────────────────────────────────╮ -│ >_ OpenAI Codex (v0.0.0) │ -│ │ -│ model: gpt-5 /model to change │ -│ speed: Standard /fast to change │ -│ directory: /tmp/project │ -╰───────────────────────────────────────╯ +╭────────────────────────────────────────╮ +│ >_ OpenAI Codex (v0.0.0) │ +│ │ +│ model: gpt-5 /model to change │ +│ speed: Standard /fast to change │ +│ directory: /tmp/project │ +╰────────────────────────────────────────╯ Tip: Model just became available