Skip to content

fix(mobile): allow terminal paste from the device clipboard - #7239

Open
DavidIlie wants to merge 2 commits into
pingdotgg:mainfrom
DavidIlie:fix/mobile-terminal-paste
Open

fix(mobile): allow terminal paste from the device clipboard#7239
DavidIlie wants to merge 2 commits into
pingdotgg:mainfrom
DavidIlie:fix/mobile-terminal-paste

Conversation

@DavidIlie

@DavidIlie DavidIlie commented Aug 16, 2026

Copy link
Copy Markdown

What?

Adds an explicit Paste action to the mobile terminal shortcut bar and the iOS and Android terminal menus.

Why?

The custom terminal surface does not expose the phone's native text-selection menu, so users controlling a remote terminal from mobile could copy commands but had no reliable way to paste them into the session.

How?

Clipboard text is read only after the user presses Paste, then sent through the existing terminal input path. Empty and unavailable clipboards produce a user-facing alert instead of an unhandled rejection, and pasting clears any pending terminal modifier before writing the text.

The clipboard read is isolated behind a small result-based helper so the success, non-text, and failure paths are covered without a native runtime.

Verification

  • pnpm exec vp test run apps/mobile/src/features/terminal/terminalClipboard.test.ts
  • pnpm --filter @t3tools/mobile typecheck
  • changed-file formatting and git diff --check

A native screenshot was not captured because this machine has no compatible T3 Code Dev client or reusable app artifact installed. The repository mobile-test workflow explicitly avoids rebuilding native code for a TypeScript-only change.

Generated with GPT-5.6 Sol via the Codex harness.


Note

Low Risk
User-initiated clipboard read and terminal input only; no auth or server changes, with tests on the helper.

Overview
Adds Paste to the mobile thread terminal so clipboard text can reach the remote shell without the native text-selection menu.

A new readTerminalClipboardText helper reads from expo-clipboard only when the user taps Paste (to limit surprise iOS paste prompts). It returns text, empty, or unavailable instead of throwing. Successful paste clears any pending ctrl/meta modifier and sends the string through the existing terminal writeInput path.

Paste is wired in three places: the keyboard accessory toolbar, the iOS terminal header menu, and the Android terminal overflow menu. It is disabled while the session is not running. Empty or failed reads show an alert; an activePasteTargetRef drops stale async results if the user leaves the screen before the read finishes.

Unit tests cover the clipboard helper’s success, non-text, and error paths.

Reviewed by Cursor Bugbot for commit f3669e8. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add clipboard paste action to the mobile terminal screen

  • Adds a Paste toolbar button and menu item to ThreadTerminalRouteScreen for both iOS and Android; paste is disabled when the terminal session is not running.
  • Introduces terminalClipboard.ts with readTerminalClipboardText, which wraps expo-clipboard and returns a tagged result (text, empty, or unavailable) instead of throwing.
  • Shows an alert when the clipboard is empty or unavailable, and logs a warning for unavailable cases.
  • Uses a ref to track the active terminal instance so that async clipboard reads are discarded if the screen has changed before the result returns.

Macroscope summarized f3669e8.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 14410194-29d0-4756-aaa3-bc828f4ef06a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 16, 2026
Comment thread apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
@macroscopeapp

macroscopeapp Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new user-facing feature (terminal paste from device clipboard) with new UI elements and behavior. While the implementation is well-scoped with unit tests, new user-facing capabilities warrant human review.

You can customize Macroscope's approvability policy. Learn more.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant