GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(android): measure markdown text in the span order its view draws it by juliusmarminge · Pull Request #1145 · software-mansion/enriched-markdown

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

What/Why?

On Android, a message whose list items contain fenced code blocks is measured shorter than its text view draws it, so whatever sits below the component (in a chat, the next message) overlaps the last lines.

The text view lays its text out through InsertionOrderedSpannable, which reads spans through the builder's sorted getSpans (priority first, then insertion order). SegmentHeightMeasurer.createStaticLayout and MeasurementStore.buildMeasureLayout build their StaticLayouts from the bare SpannableStringBuilder instead, which the framework reads in a different order. When two LineHeightSpans share a line, as the list's line height and a nested code block's margin spacer do, the two layouts can pick a different winner for that line's height. #1102 fixed one such pair by giving the list span priority. This change removes the mismatch for every pair: a new inViewSpanOrder(), next to the wrapper, gives the measuring layouts the same view of the text that the text view draws.

Drawn output is unchanged. Only the measured height moves, to match what is drawn.

Testing

Reproduced in T3 Code on a Pixel 10 Pro emulator (Android 17). The message below, followed by another message, overlapped on a build of 1d00a92 (plus T3's unrelated fork changes). With this change on top, the gap is correct:

1. Install the dependencies:

   ```bash
   pnpm install
   ```

2. Build for production:

   ```bash
   pnpm build
   ```

If any step fails, start again from step 1.

This closing paragraph must stay fully readable.
Before After
Before After

(Full fixture: 8 steps, issue-28207-fixture.md.)

I could not reproduce the remaining mismatch under Robolectric. On 1d00a92, a unit test comparing SegmentHeightMeasurer.createStaticLayout with a laid-out EnrichedMarkdownInternalText for this structure passes at SDK 30 and 35, so this PR adds no unit test. The device reproduction is the evidence. I'm happy to add a test if you know a setup that reproduces it.

PR Checklist

  • Code compiles and runs on iOS (Android-only change)
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@juliusmarminge @claude
fix(android): measure markdown text in the span order its view draws it
9aa28b9
Refs pingdotgg/t3code#28207

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge
juliusmarminge force-pushed the fix/android-measure-in-view-span-order-upstream branch from 3ee42ef to 9aa28b9 Compare November 9, 2026 06:12
This was referenced Nov 9, 2026
fix(android): measure markdown text in the span order its view draws it pingdotgg/enriched-markdown#14
Merged
fix(mobile): nested code blocks no longer overlap the next message on Android pingdotgg/t3code#28524
Merged
@hryhoriiK97

hryhoriiK97 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the detailed report! I tried to reproduce this on current main (after the streaming rebuild) and couldn't.

I ran your fixture on real devices (Galaxy A57 with Android 17, moto g57 with Android 16), plus some variations: an 8-step version, bullets and nested lists with code blocks, both flavors, three widths, a chat-like markdownStyle with a list lineHeight, and font scale 1.3, all inside a FlatList. I also logged both measurement paths: building the layout from the bare text and through the view's span order gave the same height every time, and the measured height matched the drawn height for all 48 messages.

So it looks like something on main changed this. Could you check whether T3 still overlaps on the latest nightly? If it does, please share the exact markdown and markdownStyle (and the font and font scale, if they're custom), and I'll reproduce it with those. I've already merged main into your branch locally, so we can move fast if it's still needed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 25, 2026
chore: sync fork/t3-mobile with upstream main (v1.2.0, 3a2c1ade) pingdotgg/enriched-markdown#18
Merged
chore(mobile): enriched-markdown fork follows upstream v1.2.0 pingdotgg/t3code#42528
Merged
Yash-Singh1 pushed a commit to pingdotgg/enriched-markdown that referenced this pull request Nov 25, 2026
@juliusmarminge @claude @Yash-Singh1
fix(android): measure markdown text in the span order its view draws it
7ad6e4b
Fixes pingdotgg/t3code#28207
Upstream: software-mansion#1145

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@juliusmarminge @hryhoriiK97
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.