Skip to content

fix(shell): handle Cmd+V image paste via BracketedPaste event#1434

Open
howardpen9 wants to merge 2 commits intoMoonshotAI:mainfrom
howardpen9:fix/cmd-v-image-paste
Open

fix(shell): handle Cmd+V image paste via BracketedPaste event#1434
howardpen9 wants to merge 2 commits intoMoonshotAI:mainfrom
howardpen9:fix/cmd-v-image-paste

Conversation

@howardpen9
Copy link
Contributor

@howardpen9 howardpen9 commented Mar 14, 2026

Summary

On macOS, Cmd+V is intercepted by the terminal emulator and delivered as a bracketed paste event, not the Ctrl+V key code. The existing c-v keybinding (which calls _try_paste_media() to detect clipboard images) is therefore never triggered — image file paths get inserted as raw text instead of [image:...] placeholders.

This PR adds a Keys.BracketedPaste handler that:

  1. Attempts _try_paste_media() first (same logic as the c-v handler)
  2. Falls back to normal text insertion if no media is detected

This makes Cmd+V behave identically to Ctrl+V for clipboard image pasting.

Closes #1433

Changes

  • src/kimi_cli/ui/shell/prompt.py: Add BracketedPaste keybinding handler inside the clipboard_available block

Test plan

  • Existing clipboard tests pass (tests/ui_and_conv/test_prompt_clipboard.py — 10/10)
  • ruff check passes
  • Manual: copy an image → Cmd+V in kimi CLI → verify [image:...] placeholder is inserted
  • Manual: copy regular text → Cmd+V → verify text is pasted normally
  • Manual: Ctrl+V still works as before

Open with Devin

When a user dismisses a question dialog (plan mode prompt, plan review,
or AskUserQuestion) without choosing, the tool now returns is_error=True
with an explicit "Do NOT proceed" instruction instead of a non-error
result that tells the LLM to continue.

Previously, EnterPlanMode returned "Proceed with implementation
directly" on dismissal, causing the LLM to bypass planning and start
coding — even when the user never gave permission. This was reported as
reckless behavior in non-yolo mode.

Closes MoonshotAI#1404
On macOS, Cmd+V is intercepted by the terminal emulator and sent as a
bracketed paste event rather than the Ctrl+V key code. This means the
existing `c-v` keybinding (which calls `_try_paste_media()` to detect
clipboard images) is never triggered, and image file paths are inserted
as raw text instead of `[image:...]` placeholders.

Add a `Keys.BracketedPaste` handler that attempts media paste first,
falling back to normal text insertion. This makes Cmd+V behave
identically to Ctrl+V for image pasting.

Closes MoonshotAI#1433
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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

Labels

None yet

Projects

None yet

1 participant