Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(mobile): read Codex glyph key hints like ⇧← alongside shift+←

tonyac93f5d791f7
diff --git a/mobile/lib/terminal/key_hints.dart b/mobile/lib/terminal/key_hints.dart
index 8a150752f..e44bd0ca8 100644
--- a/mobile/lib/terminal/key_hints.dart
+++ b/mobile/lib/terminal/key_hints.dart
@@ -23,9 +23,9 @@ class KeyHint {
final KeyChord chord;
- /// The key as the chrome printed it — `ctrl+]`, `⌥+↓`, `shift + ←` — for the
- /// button to repeat word for word, so it reads as the hint beside it rather
- /// than as a translation of it.
+ /// The key as the chrome printed it — `ctrl+]`, `⌥+↓`, `⇧←`, `shift + ←` —
+ /// for the button to repeat word for word, so it reads as the hint beside it
+ /// rather than as a translation of it.
final String keyText;
/// What the hint says the key does, as the CLI worded it — `cycle`,
@@ -80,10 +80,18 @@ const int _maxHints = 4;
/// A key as the chrome writes one: modifiers joined to a key by `+`, or a bare
/// function key. Modifiers are required for everything else — a plain `esc`
/// or `tab` is a key the phone already has.
+///
+/// ⚠️ **Both spellings, old and new.** Codex 0.156.1 writes a modifier joined
+/// by `+` (`shift+←`, `⌥+↓`); 0.161.0 writes the macOS glyph straight onto
+/// the key (`⇧← to answer`), and its glyph keys too (`⇥`, `⏎`). A pattern that
+/// knew only the first read the queued question's key as no key at all: the
+/// queue was seen, and the strip offered nothing to open it with. The bare
+/// glyph and the glyph keys are added alongside, never in place of, the `+`
+/// form — either CLI may be on the far side.
final RegExp _chord = RegExp(
r'(?<![\w+])'
- r'((?:(?:shift|ctrl|control|alt|option|opt|meta|[⇧⌃⌥])\s*\+\s*)+'
- r"(?:tab|enter|return|esc|escape|space|backspace|delete|del|up|down|left|right|home|end|pageup|pagedown|pgup|pgdn|f(?:1[0-2]|[1-9])|[←→↑↓]|[a-z0-9]|[\]\[\\/.,;'`=\-])"
+ r'((?:(?:shift|ctrl|control|alt|option|opt|meta|[⇧⌃⌥])\s*\+\s*|[⇧⌃⌥])+'
+ r"(?:tab|enter|return|esc|escape|space|backspace|delete|del|up|down|left|right|home|end|pageup|pagedown|pgup|pgdn|f(?:1[0-2]|[1-9])|[←→↑↓]|[⇥⏎↵⌫]|[a-z0-9]|[\]\[\\/.,;'`=\-])"
r'|f(?:1[0-2]|[1-9]))'
r'(?![\w])',
caseSensitive: false,
diff --git a/mobile/lib/terminal/question_pane.dart b/mobile/lib/terminal/question_pane.dart
index c7edaf7ee..952290e67 100644
--- a/mobile/lib/terminal/question_pane.dart
+++ b/mobile/lib/terminal/question_pane.dart
@@ -250,9 +250,11 @@ final RegExp _outputGlyph = RegExp(
/// under a dead dialog, the dialog was dropped, and the keyboard never came up
/// for it. Measured on Codex 0.156.1, question 2 of 2. The modifiers sit before
/// the `\b` group because a `\b` cannot follow `+` into `↓` or `]`: neither
-/// side is a word character.
+/// side is a word character. The bare glyph is there as well as the `+` form,
+/// not instead of it: Codex 0.161.0 writes it straight onto the key (`⇧←`,
+/// `⌥↓`), 0.156.1 with the `+`.
final RegExp _footerHint = RegExp(
- r'\u00b7|[⌥⌃⇧]\s*\+|\b(?:ctrl|shift|alt|option|opt|meta)\s*\+|\b(to (select|cancel|confirm|submit|toggle|navigate|edit|add|interrupt|view|expand)|esc|enter|tab|\u2191/\u2193|\u2190/\u2192)\b',
+ r'\u00b7|[⌥⌃⇧]\s*\+|[⌥⌃⇧]|\b(?:ctrl|shift|alt|option|opt|meta)\s*\+|\b(to (select|cancel|confirm|submit|toggle|navigate|edit|add|interrupt|view|expand)|esc|enter|tab|\u2191/\u2193|\u2190/\u2192)\b',
caseSensitive: false,
);