mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
cac5354455
## Why Inside tmux, `Shift+Enter` can still reach Codex as a plain `Enter` even when tmux has extended keys enabled. In `csi-u` tmux panes, Codex needs to request `modifyOtherKeys` mode 2 so tmux moves the pane from `VT10x` into extended-key mode and preserves the Shift modifier. Without that extra request, composer `Shift+Enter` submits the draft instead of inserting a newline. Fixes #21699. ## What Changed - Detect tmux sessions and read the active `extended-keys-format`, preferring the pane-local value before falling back to the global option. - Request `modifyOtherKeys` mode 2 for tmux panes using `csi-u` extended keys, and reset it when restoring keyboard reporting. - Add unit coverage for tmux detection, the format gate, and the emitted `modifyOtherKeys` escape sequence. ## How to Test 1. In tmux, configure: ```tmux set-option -g extended-keys on set-option -g extended-keys-format csi-u ``` 2. Start Codex in a fresh tmux pane from this branch. 3. From another pane, confirm the Codex pane reports `mode=Ext 2`: ```bash tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index} mode=#{pane_key_mode} cmd=#{pane_current_command}' ``` 4. Type a draft in the composer and press `Shift+Enter`; confirm it inserts a newline instead of submitting. 5. Also confirm plain `Enter` still submits as before. Targeted tests: - `cargo test -p codex-tui` ## Notes - Manual verification used both real `Shift+Enter` in iTerm2/tmux and `tmux send-keys ... S-Enter` to confirm the tmux pane changes from `VT10x` to `Ext 2` and preserves newline behavior. - On this checkout, the broader `codex-tui` test run currently reaches unrelated existing failures in `status::tests::*` plus a later stack overflow in `tests::fork_last_filters_latest_session_by_cwd_unless_show_all`.
cac5354455
ยท
2026-05-10 11:45:49 -03:00
History