Skip to content

fix(ios): Copy as Markdown no longer splits bold after the first character - #12

Merged
juliusmarminge merged 1 commit into
pingdotgg:fork/t3-mobilefrom
dansanduleac:fix/copy-markdown-split-runs
Nov 9, 2026
Merged

juliusmarminge merged 1 commit into
pingdotgg:fork/t3-mobilefrom
dansanduleac:fix/copy-markdown-split-runs

Conversation

@dansanduleac

@dansanduleac dansanduleac commented Nov 2, 2026 •

Copy link
Copy Markdown

On iOS, selecting **What** in a chat reply and choosing Copy as Markdown pasted **W****hat**. Reported against the T3 Code iOS app 2.2.0.

extractMarkdownFromAttributedString wraps each attribute run in its own delimiters. Runs also split on attributes that have no inline meaning: ListItemRenderer anchors ListItemMarkerStartAttribute on a list item's first grapheme, so a bold lead-in such as - **What**: … arrives as W + hat. Links break the same way ([d](url)[ocs](url)).

Now, when a run has the same inline delimiters as the segment that still ends the output, its text goes inside that span: the closing delimiters move past it instead of a new span opening. Runs with different formatting are still wrapped separately (**a***b*).

Testing

  • Adds __tests__/ios/ENRMMarkdownExtractorTests.mm: a bold run split by an unrelated attribute, bold at a list-item start, and adjacent bold/italic runs.
  • I compiled MarkdownExtractor.m for the iOS simulator into a standalone harness with stubbed constants and ran it with simctl spawn. Shipped code: **W****hat**, - **W****hat**: next, see [d](https://x.y)[ocs](https://x.y) now. Patched: **What**, - **What**: next, see [docs](https://x.y) now. **a***b* is unchanged.
  • clang-format --dry-run --Werror passes on both files.
  • Not run: the example-app XCTest lane (yarn turbo run test:ios), so the new test file has not run in the target yet.

Reviewed with sol-loop: 1 round with gpt-6.1-sol on high. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

Note

Fix iOS Markdown extractor to merge bold spans split across attribute runs

  • "Copy as Markdown" was splitting bold formatting after the first character when an unrelated attribute (e.g. a list-marker anchor) started a new attributed run. The extractor now tracks the previous delimiter pair and its output segment.
  • When the next run has the same nonempty formatting and is contiguous with no pending blank line, extractMarkdownFromAttributedString removes the prior closing delimiters, appends the new text, and restores the closing delimiters after it. Runs with different formatting stay separately wrapped.
  • buildInlineDelimiters in MarkdownExtractor.m now builds separate opening and closing delimiter strings instead of one wrapped string. Formatting checks, nesting order, and link-specific monospace/underline handling are preserved.
  • Adds XCTest cases in ENRMMarkdownExtractorTests.mm covering bold split by an unrelated attribute, bold at a list item start, and adjacent bold/italic runs.
  • Behavioral Change: adjacent runs with identical formatting are now emitted as one Markdown span; check extractMarkdownFromAttributedString and buildInlineDelimiters in MarkdownExtractor.m if consumers rely on per-run wrapping.

Macroscope summarized d3bd0d5.

…acter

Copying a selection like **What** from a list item gave **W****hat**:
the extractor wrapped each attribute run separately, and runs also split
on attributes with no inline meaning, such as the list-marker anchor on
an item's first grapheme. Runs with the same inline delimiters as the
segment that still ends the output now extend that span.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: befcafc6-7dca-458c-b836-8bfcef754977

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T02:17:26.120647Z d3bd0d5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks! I pointed this at fork/t3-mobile, the branch T3 Code's archive is built from (main here is just an old upstream mirror), and landed it. It ships in T3 Code's 1.2.0-t3.18 archive (pingdotgg/t3code#32180). Your commit is also open upstream, unchanged, as software-mansion#1143.

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