Skip to content

Commit 8a7f394

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 274d9b4 commit 8a7f394

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
@@ -255,10 +255,13 @@ impl Tui {
255255
Some(Ok(event)) = crossterm_events.next() => {
256256
match event {
257257
// Detect Ctrl+V to attach an image from the clipboard.
258+
// Handle both Press and Release to work across all platforms:
259+
// - Windows typically sends Release events
260+
// - Linux/macOS typically send Press events
258261
Event::Key(key_event @ KeyEvent {
259262
code: KeyCode::Char('v'),
260263
modifiers: KeyModifiers::CONTROL,
261-
kind: KeyEventKind::Press,
264+
kind: KeyEventKind::Press | KeyEventKind::Release,
262265
..
263266
}) => {
264267
match paste_image_to_temp_png() {

0 commit comments

Comments
 (0)