Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedmackinleysmith(GitHub profile, opens in a new tab)wants to merge 250+ commits intot3code/rebuild-mobile-app-swift fromrefs/pull/11297/headopened View on GitHub

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.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR adds a substantial completed-message selection and Markdown clipboard feature, including new native text layout and code-card rendering across production chat paths. The new copy override also leaves context and attachment preservation needing verification.

      Not approved because:

      • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
      Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Pinned expo-audio to exactly 57.0.4 in 5193d2fc37 to fix the unrelated Release Smoke failure.

      The smoke test deliberately deletes its temporary lockfile and resolves dependencies again. The previous ~57.0.4 range now permits 57.0.5, while our patch targets expo-audio@57.0.4, causing ERR_PNPM_UNUSED_PATCH. The exact pin keeps fresh resolution aligned with the patch. The committed lockfile already used patched 57.0.4, so the resolved runtime dependency is unchanged.

      Validation: vp install --frozen-lockfile and node scripts/release-smoke.ts both passed locally. GitHub CI will rerun on this commit.

    4. 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.

    5. @@ -836,6 +871,20 @@
      871+ }
      872+
      873+ init(
      874+ prose: [MarkdownRenderedBlock],
      875+ selectionContext: MarkdownSelectionContext,
      876+ textColor: MarkdownTextColor
      877+ ) {
      878+ self.content = .prose(prose)
      879+ self.selectionContext = selectionContext
      880+ self.lineSpacing = 4
      881+ self.textColor = textColor
      882+ self.wrapsLines = true
      883+ }
      884+
      836885 func makeCoordinator() -> Coordinator {
      837886 Coordinator()
      838887 }
      839888
      840889 func makeUIView(context: Context) -> UITextView {
      841- let textView = FeatureInlineSkillTextView()
      890+ let textView = MarkdownSelectionTextView(frame: .zero, textContainer: nil)
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 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).
    6. Note

      This comment is posted by Julius' dot

      The PR targets t3code/rebuild-mobile-app-swift at 285d2ab, but its current comparison includes the native app and release infrastructure alongside the described cross-block text selection change. Please confirm the intended base commit and link a comparison that isolates this patch, or rebase onto the intended current branch. This will let us assess the one-problem scope without attributing inherited stack changes to this PR.

    7. Note

      🤖 GPT-6 Astra responding on behalf of Theo

      We're closing this as part of a cleanup of old PRs. Thank you for the time and care you put into this contribution.

      The current comparison includes 302 files and 111,278 changed lines, with conflicts in 71 files against the target branch. Much of that comparison comes from diverged base history, beyond the change described here. The latest implementation commit is from 2026-09-14.

      At this point, regenerating a focused patch against the current intended base would be easier to review and maintain than updating this PR. We appreciate the problem report and the work already done; this thread will remain available as a reference. If you revisit it, please confirm the current direction with us and link a fresh, focused PR back here.

Sign in to join this conversation.