Files
codex/codex-rs/tui/src/activation_key_guard_tests.rs
T
Felipe Coury db3c44414c Add directional conversation focus shortcuts in workspace mode (#59287)
## What changed

- Add configurable `focus_pane_left` and `focus_pane_right` actions, defaulting to `leader left` / `leader h` and `leader right` / `leader l`.
- Move focus to the parent or open side conversation without reopening a hidden pane. Preserve the current interaction when no neighbor is available, and accept fresh typing after a no-op shortcut while suppressing reported key repeats.
- Expose the actions in the keymap picker and configuration schema, and prevent workspace-only pane bindings from claiming keys in classic mode.

## Testing

Add regression coverage for pane navigation, preserved transcript selection and search, fresh typing after a no-op, key capture, and binding conflicts and limits.

GitOrigin-RevId: 7f7629d15cffcd35d1353b36c5c9208dbb1034e8
2026-11-04 01:40:12 +00:00

40 lines
1.3 KiB
Rust

use super::*;
use crate::key_hint;
use crossterm::event::KeyCode;
#[test]
fn suppresses_activation_until_release_and_bounds_legacy_presses() {
let start = Instant::now();
let key = key_hint::plain(KeyCode::Enter);
let mut guard = ActivationKeyGuard::new_at(key, start, /*reported_repeats_only*/ true);
assert!(guard.consume_at(key, KeyEventKind::Repeat, start));
assert!(guard.consume_at(key, KeyEventKind::Release, start));
assert!(!guard.consume_at(key, KeyEventKind::Press, start));
let mut guard = ActivationKeyGuard::new_at(key, start, /*reported_repeats_only*/ false);
for elapsed in [900, 1_300] {
assert!(guard.consume_at(
key,
KeyEventKind::Press,
start + Duration::from_millis(/*millis*/ elapsed),
));
}
assert!(!guard.consume_at(
key,
KeyEventKind::Press,
start + Duration::from_millis(/*millis*/ 2_301),
));
assert!(!guard.is_active());
let mut guard = ActivationKeyGuard::new_at(
key_hint::plain(KeyCode::BackTab),
start,
/*reported_repeats_only*/ true,
);
let tab = key_hint::plain(KeyCode::Tab);
assert!(guard.consume_at(tab, KeyEventKind::Repeat, start));
assert!(guard.consume_at(tab, KeyEventKind::Release, start));
assert!(!guard.is_active());
}