Skip to content

Commit 733ca7d

Browse files
committed
fix: Handle both Press and Release events for Ctrl+V clipboard image paste
- Windows generates Release events for Ctrl+V, while Linux/macOS generate Press events - Updated event matching to handle both KeyEventKind::Press and KeyEventKind::Release - Maintains backward compatibility across all platforms - Fixes clipboard image paste not working on Windows systems
1 parent eb16111 commit 733ca7d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

codex-rs/tui/src/tui.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,13 @@ impl Tui {
298298
Some(Ok(event)) = crossterm_events.next() => {
299299
match event {
300300
// Detect Ctrl+V to attach an image from the clipboard.
301+
// Handle both Press and Release to work across all platforms:
302+
// - Windows typically sends Release events
303+
// - Linux/macOS typically send Press events
301304
Event::Key(key_event @ KeyEvent {
302305
code: KeyCode::Char('v'),
303306
modifiers: KeyModifiers::CONTROL,
304-
kind: KeyEventKind::Press,
307+
kind: KeyEventKind::Press | KeyEventKind::Release,
305308
..
306309
}) => {
307310
match paste_image_to_temp_png() {

0 commit comments

Comments
 (0)