kiro-cli: /copy to clipboard copies rendered TUI buffer, not raw message text
[DRAFT] kiro-cli: /copy to clipboard copies rendered TUI buffer, not raw message text
Operating System: macOS 26.4.1, Apple Silicon
Kiro Version: 2.4.1 (kiro-cli)
Bug Description
The /copy to clipboard slash command in kiro-cli copies the rendered terminal buffer rather than the raw message text. Every paste produces syntactically broken output: heredoc content gains the TUI panel's 2-space left indent, and lines that exceed the terminal width are split at the column boundary.
I used /copy to clipboard on a response containing a shell heredoc, then pasted the result into a terminal. The code was broken before I could run it.
Steps to Reproduce
- Start a kiro-cli session:
kiro-cli - Ask for a shell snippet that includes a heredoc, e.g.:
Write a shell config file using a heredoc. Include at least one line with a long value likely to exceed ~80 columns.
- When the response appears in the TUI panel, run
/copy to clipboard - Paste into a terminal (iTerm2, macOS Terminal, or any shell prompt)
- Observe the pasted content
Minimal reproducible example — response contains:
cat > ~/.config/app/config << 'EOF'
[settings]
session_valid = python3 -c "import os,time; exit(0 if time.time() < os.path.getmtime(os.path.expanduser('~/.cache/app/token')) + 7200 else 1)"
token_refresh = refresh-token --daemon
EOF
Pasted result:
cat > ~/.config/app/config << 'EOF'
[settings]
session_valid = python3 -c "import os,time; exit(0 if time.time() < os.path.getmtime(os.path.expanduser('~/.cache/app/token')) + 7200
else 1)"
token_refresh = refresh-token --daemon
EOF
Expected Behavior
/copy to clipboard should place the raw message text on the clipboard — the same plain-text/Markdown string that was passed to the TUI renderer, with no panel padding and no column wrapping. The pasted content above should be identical to the code block as written.
Additional Context
Two distinct artifacts introduced by the render-buffer scrape:
-
Box-padding bleed. Every interior line of the code block carries the TUI panel's 2-space left indent. A heredoc that writes a config file silently writes every value with leading spaces — broken behavior that's easy to miss.
-
Soft-wrap split. Lines that exceed the terminal width are split at the column boundary.
else 1)"becomes an orphaned continuation line, which is a shell syntax error on paste.
Root cause: /copy to clipboard captures the visual terminal buffer rather than the source message text. The render pipeline adds panel padding and column wrapping; neither should appear in clipboard content.
Proposed fix — OSC 52: Write clipboard content via OSC 52 using the raw message text, before the render pipeline runs:
\e]52;c;<base64-encoded-raw-text>\a
OSC 52 is supported by iTerm2, Warp, Ghostty, kitty, and tmux (set-clipboard on). This is the same mechanism used by Neovim, lazygit, and tmux-yank for clipboard writes from TUI contexts. For terminals that don't support OSC 52, fall back to pbcopy/xclip/xsel with the same raw string.
Impact:
- Affects all kiro-cli users who use
/copy to clipboardto paste generated code - Severity: every
/copyinvocation produces broken output; heredoc and multi-line shell expression errors are silent - Workaround: manually strip indent and rejoin wrapped lines before running
References:
- OSC 52 spec: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
- Neovim OSC 52 clipboard provider:
runtime/autoload/provider/clipboard.vim - Same issue filed for GSD TUI copy: open-gsd/gsd-pi#69
- Related Warp feature request (
paste_transform): warpdotdev/warp#11608
Thanks for filing this detailed bug report! The issue with /copy to clipboard grabbing the rendered TUI output (with padding and column wraps) instead of the raw message text is a great catch — that definitely makes pasted code unusable. A maintainer will review this shortly, and we appreciate you including such a clear reproducible example to help us track it down!
Thanks for raising this! We've marked it as a feature request for the team to evaluate. We'll update this issue if it gets prioritized.
Thanks for raising this.
Closing this as stale -- it hasn't had any activity in several months. If you're still seeing this on the current version, please open a new issue with your Kiro version, OS, and reproduction steps. To update, download from kiro.dev.
Confirmed fixed on kiro-cli 2.21.4 (macOS 26.4.1, Apple Silicon). /copy to clipboard now writes raw message text — verified via pbpaste | cat -vet: no panel indent, no soft-wrap splits on lines exceeding 80 columns. Current builds copy via NSPasteboard (arboard) rather than scraping the rendered TUI buffer, which removes the root cause. Leaving closed.