Skip to content

Commit 00ef9d3

Browse files
fix(tui) Support image paste from clipboard on native Windows (openai#7514)
Closes openai#3404 ## Summary On windows, ctrl+v does not work for the same reason that cmd+v does not work on macos. This PR adds alt/option+v detection, which allows windows users to paste images from the clipboard using. We could swap between just ctrl on mac and just alt on windows, but this felt simpler - I don't feel strongly about it. Note that this will NOT address image pasting in WSL environments, due to issues with WSL <> Windows clipboards. I'm planning to address that in a separate PR since it will likely warrant some discussion. ## Testing - [x] Tested locally on a Mac and Windows laptop
1 parent f3989f6 commit 00ef9d3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

codex-rs/tui/src/chatwidget.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,9 @@ impl ChatWidget {
13831383
modifiers,
13841384
kind: KeyEventKind::Press,
13851385
..
1386-
} if modifiers.contains(KeyModifiers::CONTROL) && c.eq_ignore_ascii_case(&'v') => {
1386+
} if modifiers.intersects(KeyModifiers::CONTROL | KeyModifiers::ALT)
1387+
&& c.eq_ignore_ascii_case(&'v') =>
1388+
{
13871389
match paste_image_to_temp_png() {
13881390
Ok((path, info)) => {
13891391
self.attach_image(

0 commit comments

Comments
 (0)