mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
[tui] Align speed hint with model hint
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -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<Span<'static>> = {
|
||||
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]
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
---
|
||||
source: tui/src/app.rs
|
||||
assertion_line: 3452
|
||||
assertion_line: 4441
|
||||
expression: rendered
|
||||
---
|
||||
╭─────────────────────────────────────────────╮
|
||||
│ >_ OpenAI Codex (v<VERSION>) │
|
||||
│ │
|
||||
│ model: gpt-test high /model to change │
|
||||
│ speed: Standard /fast to change │
|
||||
│ speed: Standard /fast to change │
|
||||
│ directory: /tmp/project │
|
||||
╰─────────────────────────────────────────────╯
|
||||
|
||||
+8
-8
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user