fix(clipboard): restore internal-clipboard paste fallback; add Termux clipboard#2351
Merged
Merged
Conversation
… clipboard Paste via Ctrl+V and the command palette stopped working on Termux (and any host without a readable OS clipboard) starting in 0.3.12 — issue #2343. Root cause: the async clipboard-paste rework (#2155) dropped the internal-clipboard fallback that the old synchronous `Clipboard::paste()` had. The background read does `arboard::Clipboard::new().get_text()`, which on Termux always fails (arboard has no Android backend). The inline handler received `Ok(None)` and returned without inserting anything and without consulting Fresh's own internal clipboard, so an in-editor copy → paste round-trip silently did nothing. Pre-0.3.12 the synchronous path fell back to the internal buffer, so it worked regardless of display server. Fix: - The paste thread now returns `system_read.or(internal_snapshot)`, captured at dispatch — restoring the in-editor round-trip on Termux, headless TTYs, and any environment where the OS clipboard is unreadable. `None` now means "nothing anywhere", so the inline, slow-path, and deadline-cancel branches stay correct with no further changes. - Add real Termux clipboard support via the `termux-clipboard-get`/`-set` helpers (termux-api), wired through a shared `read_system_clipboard()` and the copy path, so text copied in/out of other Android apps works too. The helpers are gated on `is_termux()` and are inert on every other platform. The async path gains a test-only system-clipboard reader seam so the regression can be reproduced deterministically (stub returning `None` while the system clipboard stays enabled) without touching the real host clipboard. The new e2e test copies inside Fresh, pastes with Ctrl+V, and asserts the internal text lands; it times out without the fallback and passes with it. https://claude.ai/code/session_01MrQuX7R9wcsYL4pUDehHay
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.
Paste via Ctrl+V and the command palette stopped working on Termux (and any
host without a readable OS clipboard) starting in 0.3.12 — issue #2343.
Root cause: the async clipboard-paste rework (#2155) dropped the
internal-clipboard fallback that the old synchronous
Clipboard::paste()had. The background read does
arboard::Clipboard::new().get_text(), whichon Termux always fails (arboard has no Android backend). The inline handler
received
Ok(None)and returned without inserting anything and withoutconsulting Fresh's own internal clipboard, so an in-editor copy → paste
round-trip silently did nothing. Pre-0.3.12 the synchronous path fell back
to the internal buffer, so it worked regardless of display server.
Fix:
system_read.or(internal_snapshot), capturedat dispatch — restoring the in-editor round-trip on Termux, headless TTYs,
and any environment where the OS clipboard is unreadable.
Nonenow means"nothing anywhere", so the inline, slow-path, and deadline-cancel branches
stay correct with no further changes.
termux-clipboard-get/-sethelpers (termux-api), wired through a shared
read_system_clipboard()andthe copy path, so text copied in/out of other Android apps works too. The
helpers are gated on
is_termux()and are inert on every other platform.The async path gains a test-only system-clipboard reader seam so the
regression can be reproduced deterministically (stub returning
Nonewhilethe system clipboard stays enabled) without touching the real host
clipboard. The new e2e test copies inside Fresh, pastes with Ctrl+V, and
asserts the internal text lands; it times out without the fallback and
passes with it.
https://claude.ai/code/session_01MrQuX7R9wcsYL4pUDehHay