Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

do not dispatch key releases (#1771)

Jeremy Rose610addbc2e28
diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs
index 3013cb6df0..86c042f813 100644
--- a/codex-rs/tui/src/app.rs
+++ b/codex-rs/tui/src/app.rs
@@ -15,6 +15,7 @@ use color_eyre::eyre::Result;
use crossterm::SynchronizedUpdate;
use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
+use crossterm::event::KeyEventKind;
use ratatui::layout::Offset;
use ratatui::prelude::Backend;
use std::path::PathBuf;
@@ -213,6 +214,7 @@ impl App<'_> {
KeyEvent {
code: KeyCode::Char('c'),
modifiers: crossterm::event::KeyModifiers::CONTROL,
+ kind: KeyEventKind::Press,
..
} => {
match &mut self.app_state {
@@ -227,6 +229,7 @@ impl App<'_> {
KeyEvent {
code: KeyCode::Char('d'),
modifiers: crossterm::event::KeyModifiers::CONTROL,
+ kind: KeyEventKind::Press,
..
} => {
match &mut self.app_state {
@@ -245,9 +248,15 @@ impl App<'_> {
}
}
}
- _ => {
+ KeyEvent {
+ kind: KeyEventKind::Press | KeyEventKind::Repeat,
+ ..
+ } => {
self.dispatch_key_event(key_event);
}
+ _ => {
+ // Ignore Release key events for now.
+ }
};
}
AppEvent::Paste(text) => {