feat(kimi-code): show clipboard image paste hint in footer#1028
Conversation
…helpers - Extract shared clipboard constants/helpers into clipboard-common.ts - Fix Linux X11 branch calling macOS-only osascript - Use native hasImage() on Linux X11, macOS, and Windows with fallbacks - Compute xclip result once and reuse on Linux - Add test coverage for unsupported MIME types, empty targets, failures, WSL, and native fallbacks
…hints and stale reads
🦋 Changeset detectedLatest commit: abe011e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3d9c1b6ea
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This reverts commit 0fd50dc.
Filter file-like native clipboard formats in clipboardHasImage() before calling native hasImage(), mirroring the guard already used by readClipboardMedia(). This prevents copied Finder files from being mis-detected as pasteable images because macOS exposes their thumbnails as image data.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ece4f7311
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Remove osascript and PowerShell fallbacks from clipboardHasImage() on macOS and Windows. The paste reader (readClipboardMedia()) only uses the native clipboard module for images on those platforms, so detecting images via methods the reader cannot consume produced misleading footer hints. Linux fallbacks (wl-paste / xclip / PowerShell under WSL) remain because they match the actual paste path.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4c625b16b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
UserMessageComponent applied truncateToWidth() to every rendered line, including the Kitty / iTerm2 inline image escape sequences produced by ImageThumbnail. pi-tui treats the embedded base64 payload inside those sequences as visible text, so truncation chopped the escape code and left behind '0m...' garbage instead of the image. Skip truncation for lines that contain an inline image protocol sequence; the image already respects maxWidthCells via ImageThumbnail.
Enable pi-tui's setClearOnShrink so that when a tall inline image is replaced by shorter content (e.g. after sending a message), the terminal rows the image previously occupied are cleared. Without this, pi-tui's differential renderer can leave behind artifacts such as duplicated input boxes.
Related Issue
No prior issue. This PR addresses a small UX gap discovered while using image paste.
Problem
kimi-code supports pasting images from the clipboard, but the shortcut differs by platform (
Ctrl+Von macOS/Linux,Alt+Von Windows). Users often do not know the correct shortcut, and there is no visual cue when the clipboard contains a pasteable image.What changed
clipboardHasImage()utility that detects image presence on macOS, Linux (Wayland/X11), WSL, and Windows without reading full image bytes.ClipboardImageHintControllerthat listens for terminal focus-in events, debounces for 1s, enforces a 30s cooldown, and shows a transient footer hint for 4s when an image is available.KimiTUI, gated on the current model supportingimage_in.@moonshot-ai/kimi-code.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.