do not dispatch key releases (#1771)
when we enabled KKP in https://github.com/openai/codex/pull/1743, we started receiving keyup events, but didn't expect them anywhere in our code. for now, just don't dispatch them at all.
This commit is contained in:
@@ -15,6 +15,7 @@ use color_eyre::eyre::Result;
|
|||||||
use crossterm::SynchronizedUpdate;
|
use crossterm::SynchronizedUpdate;
|
||||||
use crossterm::event::KeyCode;
|
use crossterm::event::KeyCode;
|
||||||
use crossterm::event::KeyEvent;
|
use crossterm::event::KeyEvent;
|
||||||
|
use crossterm::event::KeyEventKind;
|
||||||
use ratatui::layout::Offset;
|
use ratatui::layout::Offset;
|
||||||
use ratatui::prelude::Backend;
|
use ratatui::prelude::Backend;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -213,6 +214,7 @@ impl App<'_> {
|
|||||||
KeyEvent {
|
KeyEvent {
|
||||||
code: KeyCode::Char('c'),
|
code: KeyCode::Char('c'),
|
||||||
modifiers: crossterm::event::KeyModifiers::CONTROL,
|
modifiers: crossterm::event::KeyModifiers::CONTROL,
|
||||||
|
kind: KeyEventKind::Press,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
match &mut self.app_state {
|
match &mut self.app_state {
|
||||||
@@ -227,6 +229,7 @@ impl App<'_> {
|
|||||||
KeyEvent {
|
KeyEvent {
|
||||||
code: KeyCode::Char('d'),
|
code: KeyCode::Char('d'),
|
||||||
modifiers: crossterm::event::KeyModifiers::CONTROL,
|
modifiers: crossterm::event::KeyModifiers::CONTROL,
|
||||||
|
kind: KeyEventKind::Press,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
match &mut self.app_state {
|
match &mut self.app_state {
|
||||||
@@ -245,9 +248,15 @@ impl App<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
KeyEvent {
|
||||||
|
kind: KeyEventKind::Press | KeyEventKind::Repeat,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
self.dispatch_key_event(key_event);
|
self.dispatch_key_event(key_event);
|
||||||
}
|
}
|
||||||
|
_ => {
|
||||||
|
// Ignore Release key events for now.
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
AppEvent::Paste(text) => {
|
AppEvent::Paste(text) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user