Skip to content

Commit cdb8f17

Browse files
joshka-oaiHolovkat
authored andcommitted
Use Option symbol for mac key hints (#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 3cff882 commit cdb8f17

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
@@ -279,6 +279,11 @@ mod tests {
279279
terminal
280280
.draw(|f| w.render_ref(f.area(), f.buffer_mut()))
281281
.expect("draw");
282+
#[cfg(target_os = "macos")]
283+
insta::with_settings!({ snapshot_suffix => "macos" }, {
284+
insta::assert_snapshot!(terminal.backend());
285+
});
286+
#[cfg(not(target_os = "macos"))]
282287
insta::assert_snapshot!(terminal.backend());
283288
}
284289

0 commit comments

Comments
 (0)