Skip to content

fix(swift-ios): select across response blocks and copy as Markdown - #11297

Open
mackinleysmith wants to merge 301 commits into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
mackinleysmith:t3code/ios-continuous-selection-prototype
Open

mackinleysmith wants to merge 301 commits into
pingdotgg:t3code/rebuild-mobile-app-swiftfrom
mackinleysmith:t3code/ios-continuous-selection-prototype

Conversation

@mackinleysmith

@mackinleysmith mackinleysmith commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

Text selection in SwiftUI responses stops at each rendered block, so users cannot copy a passage spanning paragraphs and code. Completed responses now render adjacent paragraphs, headings, ordinary lists, and code in one native selectable text view. Copying a selection produces Markdown for only the selected portion, preserving inline formatting, links, list markers, and code fences.

Code wraps within the response and retains its language label and Copy button. Streaming retains the existing per-block rendering. Tables, images, blockquotes, task lists, and other specialized blocks still form selection boundaries. Clipboard output is reconstructed Markdown, rather than a byte-for-byte slice of the original source.

Why

This is the more ambitious change compared with the targeted full-response Copy button in #11252, but it is the approach we believe is correct. Users should be able to select the passage they want, cross paragraph and code boundaries naturally, and paste usable Markdown. A full-response button is useful, but it does not solve copying part of a response.

This PR is independent of #11252 and excludes its footer button change. It applies only to the native SwiftUI client; there are no server, protocol, provider, web, desktop, or React Native changes.

UI Changes

Before: paragraphs and code are separate selection regions.

Original SwiftUI response layout with separate prose and code blocks

After: a physical iPhone recording shows selection across prose and code, copying, and pasting the resulting Markdown. The demo build includes the separate footer Copy button from #11252.

Selecting across paragraphs and code, then pasting the selected Markdown on iPhone

Validation

  • Physical iPhone 14 Pro testing with the isolated development app, including cross-block selection and Markdown paste.
  • 48 focused tests passed in MarkdownDocumentTests and MarkdownSelectionCopyTests, covering rendering boundaries, nested lists, partial formatting, links, Unicode, code fences, and native clipboard behavior.
  • git diff --check.

Checklist

  • This PR is focused on one behavior
  • I explained what changed and why
  • I included before/after UI evidence
  • I included a short interaction recording as a GIF

Model: GPT-6. Harness: Codex in T3 Code.

t3dotgg added 30 commits August 18, 2026 14:32
t3dotgg and others added 23 commits September 13, 2026 20:07
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Theo Browne <me@t3.gg>
@mackinleysmith
mackinleysmith force-pushed the t3code/ios-continuous-selection-prototype branch from 5193d2f to 1b25f08 Compare September 14, 2026 16:12
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.


func makeUIView(context: Context) -> UITextView {
let textView = FeatureInlineSkillTextView()
let textView = MarkdownSelectionTextView(frame: .zero, textContainer: nil)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium Chat/MarkdownMessageView.swift:890

Copying a completed message selection no longer preserves context or attachment metadata, so pasting it into the composer cannot restore the referenced context or retained attachment. makeUIView now creates MarkdownSelectionTextView, which bypasses the FeatureInlineSkillTextView.onCopySelection callback configured in updateUIView; its copy(_:) path writes reconstructed Markdown directly to UIPasteboard instead of calling FeatureContextClipboard.write with clipboardSource and messageContext. Preserve that callback path for MarkdownSelectionTextView (or forward its copy override through it).

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/swift-ios/Features/Chat/MarkdownMessageView.swift around line 890:

Copying a completed message selection no longer preserves context or attachment metadata, so pasting it into the composer cannot restore the referenced context or retained attachment. `makeUIView` now creates `MarkdownSelectionTextView`, which bypasses the `FeatureInlineSkillTextView.onCopySelection` callback configured in `updateUIView`; its `copy(_:)` path writes reconstructed Markdown directly to `UIPasteboard` instead of calling `FeatureContextClipboard.write` with `clipboardSource` and `messageContext`. Preserve that callback path for `MarkdownSelectionTextView` (or forward its copy override through it).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants