Skip to content

macOS: Ctrl+V / Cmd+V does not paste clipboard images (terminal emulator limitation) #3104

@idanshimon

Description

@idanshimon

Summary

Pasting clipboard images via Ctrl+V or Cmd+V does not work on macOS. This feature works on Windows out of the box.

Root Cause

The Copilot CLI detects image paste via an empty bracketed paste sequence (\x1B[200~\x1B[201~). On Windows, Windows Terminal emits this sequence when Ctrl+V is pressed with an image-only clipboard — triggering onEmptyPasteFallback()ClipboardManager().getImageData().

On macOS, terminal emulators (Terminal.app, iTerm2) intercept Cmd+V at the OS level:

Clipboard content What the terminal sends to the process
Text Bracketed paste with the text
Image only Nothing at all ← the problem

Ctrl+V (without Cmd) reaches the process as raw byte \x16 (ASCII 22), which is treated as a literal character — not a paste trigger.

Expected Behavior

Ctrl+V (or some keyboard shortcut) in the Copilot CLI on macOS should attach a clipboard image when one is present, matching the Windows experience.

Suggested Fix

In the key handler, detect \x16 (Ctrl+V) and check ClipboardManager().getAvailableFormats() or getImageData(). If an image is found and no text is present, proceed with the image attachment flow directly — without needing the bracketed paste sequence as intermediary.

Workaround

A community monkey-patch is available that intercepts \x16 in process.stdin.read() and injects the bracketed paste sequence when an image is on the clipboard:

👉 https://github.com/idanshimon/copilot-cli-image-paste

curl -fsSL https://raw.githubusercontent.com/idanshimon/copilot-cli-image-paste/main/patch.sh | bash

Environment

  • macOS (Apple Silicon + Intel, both affected)
  • Terminal.app and iTerm2 (both affected — OS-level limitation)
  • Copilot CLI 1.0.40-0 (also observed on earlier versions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:input-keyboardKeyboard shortcuts, keybindings, copy/paste, clipboard, mouse, and text input

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions