Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix: Don't trigger keybindings view on input burst (#7980)

Pedro Batistafc53411938f6
diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs
index 919866b00c..17877e4bfa 100644
--- a/codex-rs/tui/src/bottom_pane/chat_composer.rs
+++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs
@@ -1511,7 +1511,8 @@ impl ChatComposer {
let toggles = matches!(key_event.code, KeyCode::Char('?'))
&& !has_ctrl_or_alt(key_event.modifiers)
- && self.is_empty();
+ && self.is_empty()
+ && !self.is_in_paste_burst();
if !toggles {
return false;
@@ -2171,6 +2172,35 @@ mod tests {
assert_eq!(composer.footer_mode(), FooterMode::ContextOnly);
}
+ #[test]
+ fn question_mark_does_not_toggle_during_paste_burst() {
+ use crossterm::event::KeyCode;
+ use crossterm::event::KeyEvent;
+ use crossterm::event::KeyModifiers;
+
+ let (tx, _rx) = unbounded_channel::<AppEvent>();
+ let sender = AppEventSender::new(tx);
+ let mut composer = ChatComposer::new(
+ true,
+ sender,
+ false,
+ "Ask Codex to do anything".to_string(),
+ false,
+ );
+
+ for ch in ['h', 'i', '?', 't', 'h', 'e', 'r', 'e'] {
+ let _ = composer.handle_key_event(KeyEvent::new(KeyCode::Char(ch), KeyModifiers::NONE));
+ }
+ assert!(composer.is_in_paste_burst());
+ assert_eq!(composer.textarea.text(), "");
+
+ std::thread::sleep(ChatComposer::recommended_paste_flush_delay());
+ let _ = composer.flush_paste_burst_if_due();
+
+ assert_eq!(composer.textarea.text(), "hi?there");
+ assert_ne!(composer.footer_mode, FooterMode::ShortcutOverlay);
+ }
+
#[test]
fn shortcut_overlay_persists_while_task_running() {
use crossterm::event::KeyCode;