Skip to content

fix(opencode): image paste on Windows Terminal 1.25+ with kitty keyboard#17674

Open
Hona wants to merge 2 commits intoanomalyco:devfrom
Hona:fix/windows-image-paste
Open

fix(opencode): image paste on Windows Terminal 1.25+ with kitty keyboard#17674
Hona wants to merge 2 commits intoanomalyco:devfrom
Hona:fix/windows-image-paste

Conversation

@Hona
Copy link
Member

@Hona Hona commented Mar 16, 2026

Summary

  • Enable kitty keyboard events: true so Windows Terminal 1.25+ reports key release events
  • Detect Ctrl+V key release on Windows to trigger clipboard image probe (WT 1.25+ swallows the press but leaks the release)
  • Add comments documenting the three Windows paste trigger paths

Depends on anomalyco/opentui#819 (stdin parser fix for split escape sequences across reads) for stability, without the opentui change, only about half of ctrl+v events are detected.

Context

Windows Terminal 1.25+ with kitty keyboard support does not send an empty bracketed paste for image-only clipboard (stable WT does). The only signal we get is the Ctrl+V key release event (CSI 118;modifier;3u), which requires events: true in the kitty keyboard config.

Copilot AI review requested due to automatic review settings March 16, 2026 00:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the TUI paste handling to support image paste on Windows Terminal Preview when kitty keyboard mode is enabled, by enabling key release events and using Ctrl+V release as the signal to probe the clipboard for image data.

Changes:

  • Enable kitty keyboard events: true in the TUI renderer config.
  • Add a Windows-only Ctrl+V release keyboard handler in the prompt to trigger an image clipboard probe/paste.
  • Clarify clipboard/paste-path behavior with additional inline comments.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/opencode/src/cli/cmd/tui/util/clipboard.ts Adds documentation about Windows-specific paste trigger paths and clarifies why direct clipboard probing is needed for images.
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx Adds Ctrl+V release detection on Windows to paste clipboard images; updates comments around paste behavior.
packages/opencode/src/cli/cmd/tui/app.tsx Enables kitty keyboard events globally so key release events can be observed (needed for WT Preview behavior).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Hona Hona force-pushed the fix/windows-image-paste branch from 34e50c3 to 342719d Compare March 16, 2026 00:47
@Hona Hona changed the title fix(opencode): image paste on Windows Terminal Preview with kitty keyboard fix(opencode): image paste on Windows Terminal 1.25+ with kitty keyboard Mar 16, 2026
@Hona
Copy link
Member Author

Hona commented Mar 16, 2026

vouch @Hona

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants