mirror of
https://github.com/openai/codex.git
synced 2026-11-19 23:05:23 +00:00
Support two-stroke TUI key chords (#36511)
## What changed - Accept two-stroke bindings such as `ctrl-x ctrl-s` in TUI keymap configuration while preserving arrays as alternative bindings. - Route chords through the active TUI context, show pending and configured chord hints, and cancel pending chords on `esc`, context changes, or a one-second timeout. - Extend `/keymap` to capture, add, replace, and display key chords. - Reject chords that conflict with active single-key bindings, overlapping-context chords, or reserved terminal shortcuts. ## Testing - Add coverage for chord parsing, validation, matching, timeout and cancellation behavior, context dispatch, key capture, and rendered shortcut hints. GitOrigin-RevId: dfdede03f518d4936ad8621ebf5537026f2b282e
This commit is contained in:
1 parent
a1dd74b535
commit
1e85ca099e
61 files changed
+3503
-660
No files matched your search
@@ -16,6 +16,7 @@ use codex_terminal_detection::terminal_info;
|
||||
|
||||
use super::ChatWidget;
|
||||
use super::queued_message_edit_hint_binding;
|
||||
use crate::app_event::KeymapCaptureMode;
|
||||
use crate::app_event::KeymapEditIntent;
|
||||
use crate::keymap::RuntimeKeymap;
|
||||
use crate::keymap_setup;
|
||||
@@ -73,12 +74,14 @@ impl ChatWidget {
|
||||
context: String,
|
||||
action: String,
|
||||
intent: KeymapEditIntent,
|
||||
capture_mode: KeymapCaptureMode,
|
||||
runtime_keymap: &RuntimeKeymap,
|
||||
) {
|
||||
let view = keymap_setup::build_keymap_capture_view(
|
||||
context,
|
||||
action,
|
||||
intent,
|
||||
capture_mode,
|
||||
runtime_keymap,
|
||||
self.app_event_tx.clone(),
|
||||
);
|
||||
@@ -169,10 +172,8 @@ impl ChatWidget {
|
||||
self.config.tui_keymap = keymap_config;
|
||||
self.copy_last_response_binding = runtime_keymap.app.copy.clone();
|
||||
self.chat_keymap = runtime_keymap.chat.clone();
|
||||
self.queued_message_edit_hint_binding = queued_message_edit_hint_binding(
|
||||
&self.chat_keymap.edit_queued_message,
|
||||
terminal_info(),
|
||||
);
|
||||
self.queued_message_edit_hint_binding =
|
||||
queued_message_edit_hint_binding(runtime_keymap, terminal_info());
|
||||
self.bottom_pane
|
||||
.set_queued_message_edit_binding(self.queued_message_edit_hint_binding);
|
||||
self.bottom_pane.set_keymap_bindings(runtime_keymap);
|
||||
|
||||
Reference in new issue
Block a user