Add opt-in "Paste in Chunks" option for terminal AI agents (e.g. Claude Code) - #761
Open
leochen4891 wants to merge 2 commits into
Open
leochen4891 wants to merge 2 commits into
leochen4891 wants to merge 2 commits into
Conversation
Long transcriptions pasted into terminal-based AI agents such as Claude Code are collapsed by the destination into a placeholder (for example "[Pasted text +N lines]") instead of being shown inline, so the text cannot be read or edited before it is submitted. Add an opt-in setting that pastes the transcription in smaller pieces so each paste stays below the destination's collapse threshold and the text renders inline. Splitting prefers whitespace and newline boundaries and falls back to a hard split for a single oversized run. The behaviour layers on top of the existing clipboard paste methods (Default / AppleScript) and is controlled by a separate toggle and chunk-size picker. Off by default; default chunk size 250 characters. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
leochen4891
marked this pull request as ready for review
June 8, 2026 19:01
Contributor
There was a problem hiding this comment.
3 issues found across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- Report paste success only when every chunk posts, so a later chunk no longer masks an earlier chunk's failure. - Always schedule the clipboard restore, including when a chunk fails partway through, so a partial paste does not leave the clipboard clobbered. - Split chunks by index arithmetic instead of repeatedly reading `count`, which is O(n) on Swift strings, avoiding O(n^2) behaviour on large transcriptions. - Add unit tests for the chunk splitter (reassembly fidelity, max-length adherence, whitespace boundaries, hard-splitting, multiline, non-positive lengths, and grapheme-cluster integrity). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
|
Thanks for the review — addressed all three issues identified by cubic in 92b8d87:
Also added unit tests for the chunk splitter ( |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a long transcription is pasted into a terminal-based AI agent such as Claude Code, the destination collapses the single large paste into a placeholder (for example
[Pasted text #N +M lines]) rather than showing it inline. The full text is still delivered, but the user cannot read or edit it before pressing Enter.Before — a long dictation collapses into a placeholder:
After — with "Paste in Chunks" enabled, the same dictation lands as full, editable inline text:
Approach
Add an opt-in Paste in Chunks setting. When enabled, VoiceInk pastes the transcription in smaller pieces so each paste stays below the destination's collapse threshold, and the text renders as visible, editable inline text.
This mirrors the behavior Wispr Flow documents for Claude Code (auto-splitting long dictations into chunks).
It is a layer on top of the existing clipboard paste — a separate toggle plus chunk-size picker that composes with both the Default and AppleScript paste methods, rather than a new mutually-exclusive method. It is complementary to the Direct Typing work in #701: Direct Typing reaches destinations where the clipboard does not work at all (for example remote desktop), whereas chunking keeps a working clipboard paste from being collapsed.
Changes
CursorPaster: the paste session now iterates over chunks with a short inter-chunk delay; splitting prefers whitespace and newline boundaries and falls back to a hard split for a single oversized run.