Skip to content

fix(clipboard): restore internal-clipboard paste fallback; add Termux clipboard#2351

Merged
sinelaw merged 1 commit into
masterfrom
claude/termux-copy-paste-issue-pdeu2p
Jun 15, 2026
Merged

fix(clipboard): restore internal-clipboard paste fallback; add Termux clipboard#2351
sinelaw merged 1 commit into
masterfrom
claude/termux-copy-paste-issue-pdeu2p

Conversation

@sinelaw

@sinelaw sinelaw commented Jun 14, 2026

Copy link
Copy Markdown
Owner

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

… 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
@sinelaw sinelaw merged commit 2de4918 into master Jun 15, 2026
8 checks passed
@sinelaw sinelaw deleted the claude/termux-copy-paste-issue-pdeu2p branch June 15, 2026 05:51
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