Skip to content

fix(cli): Ctrl+V now pastes text from clipboard#9045

Open
idreesmuhammadqazi-create wants to merge 2 commits intoKilo-Org:mainfrom
idreesmuhammadqazi-create:session/agent_c2a69499-1205-4413-b523-b67c442fb63a
Open

fix(cli): Ctrl+V now pastes text from clipboard#9045
idreesmuhammadqazi-create wants to merge 2 commits intoKilo-Org:mainfrom
idreesmuhammadqazi-create:session/agent_c2a69499-1205-4413-b523-b67c442fb63a

Conversation

@idreesmuhammadqazi-create
Copy link
Copy Markdown
Contributor

Summary

Fixes Ctrl+V paste functionality in the Kilo CLI TUI. Previously, Ctrl+V only pasted images from the clipboard. Text paste relied on terminal bracketed paste mode, which doesn't work in all terminal configurations. This fix adds explicit text clipboard handling when Ctrl+V is pressed.

Problem

When users pressed Ctrl+V in the Kilo CLI prompt:

  • If clipboard contained an image → worked correctly
  • If clipboard contained text → nothing happened (in terminals without bracketed paste)

The issue occurred because the input_paste keybind handler only checked for images and did nothing for text content.

Solution

Extended the input_paste handler in packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx to:

  1. Read clipboard content using Clipboard.read()
  2. If it's an image → paste as attachment (existing behavior)
  3. If it's text → normalize line endings, apply paste summary for large text, and insert at cursor position
  4. Prevent default to avoid duplicate pastes

Modified Files

  • packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx (lines 930-959)

Testing

Tested with the following scenarios:

  1. Text clipboard → Pastes at cursor position with proper formatting
  2. Large text (>5 lines or >800 chars) → Shows paste summary badge
  3. Image clipboard → Pastes as attachment (existing behavior preserved)
  4. Multiple terminals → Works in terminals that forward Ctrl+V to the application

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Notes

This is a minimal fix that follows existing patterns in the codebase. The paste summary feature was already implemented and is reused here for consistency.

Ctrl+V was only pasting images, now works for text too
Comment thread packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx Outdated
Comment thread packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Apr 16, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Reviewed by gpt-5.4-2026-03-05 · 218,359 tokens

@idreesmuhammadqazi-create
Copy link
Copy Markdown
Contributor Author

@marius-kilocode can you review this?
and whats @marius-kiloclaw btw?

@johnnyeric johnnyeric requested a review from alex-alecu April 21, 2026 19:47
@@ -951,7 +942,22 @@ export function Prompt(props: PromptProps) {
})
return
}
// If no image, let the default paste behavior continue
// If text in clipboard, paste it
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This entire block should be wrapped in // kilocode_change - check root Agents.md for instructions.

@alex-alecu
Copy link
Copy Markdown
Contributor

@idreesmuhammadqazi-create please attach an example of this fix working in a terminal without bracketed paste. Thanks for the contribution!

@alex-alecu alex-alecu self-assigned this Apr 22, 2026
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.

2 participants