Skip to content

Commit 603b138

Browse files
joshka-oaiJeffCarpenter
authored andcommitted
Use Option symbol for mac key hints (openai#5582)
## Summary - show the Option (⌥) symbol in key hints when the TUI is built for macOS so the shortcut text matches the platform terminology ## Testing - cargo test -p codex-tui ------ https://chatgpt.com/codex/tasks/task_i_68fab7505530832992780a9e13fb707b
1 parent 93d6c5c commit 603b138

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

codex-rs/tui/src/key_hint.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ use ratatui::style::Style;
66
use ratatui::style::Stylize;
77
use ratatui::text::Span;
88

9+
#[cfg(target_os = "macos")]
10+
const ALT_PREFIX: &str = "⌥ + ";
11+
#[cfg(not(target_os = "macos"))]
912
const ALT_PREFIX: &str = "alt + ";
1013
const CTRL_PREFIX: &str = "ctrl + ";
1114
const SHIFT_PREFIX: &str = "shift + ";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
source: tui/src/status_indicator_widget.rs
3+
assertion_line: 289
4+
expression: terminal.backend()
5+
---
6+
"• Working (0s • esc to interrupt) "
7+
" "
8+
" ↳ first "
9+
" ↳ second "
10+
" ⌥ + ↑ edit "
11+
" "
12+
" "
13+
" "

codex-rs/tui/src/status_indicator_widget.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ mod tests {
284284
terminal
285285
.draw(|f| w.render_ref(f.area(), f.buffer_mut()))
286286
.expect("draw");
287+
#[cfg(target_os = "macos")]
288+
insta::with_settings!({ snapshot_suffix => "macos" }, {
289+
insta::assert_snapshot!(terminal.backend());
290+
});
291+
#[cfg(not(target_os = "macos"))]
287292
insta::assert_snapshot!(terminal.backend());
288293
}
289294

0 commit comments

Comments
 (0)