Skip to content

Keep Android assistant replies from overlapping the next message - #10380

Closed
boudra wants to merge 1 commit into
mainfrom
diagnose-assistant-turn-overflow-android
Closed

boudra wants to merge 1 commit into
mainfrom
diagnose-assistant-turn-overflow-android

Conversation

@boudra

@boudra boudra commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Linked issue

No matching issue found.

Type of change

  • Bug fix

Reasoning

On Android, an assistant reply with blockquotes nested inside a list can overlap its Worked for … footer and the next user message. The displayed text and the layout measurement apply spans in different orders. The list-wide line height also inflates the blockquote spacers when it runs after them.

Apply the list line height first and use the same span ordering in the measurement layouts and the displayed text view.

Goals

  • Keep list-nested blockquote padding and bottom spacing at their configured heights.
  • Give the reply enough space for the text it renders, including when Markdown is measured in segments.
  • Cover both behaviors with an Android regression test.

Non-goals

  • Changes to the chat timeline, turn footer, or Markdown styling on other platforms.

QA

  • Opened a conversation on an Android API 35 emulator with five blockquotes nested in a list, followed by a user message. Before the fix, the reply reserved 4,236 px and drew 4,436 px, overlapping the footer and next message by 200 px. After rebuilding, both heights were 4,236 px and the overlap was gone. Blockquote spacers measured 12 dp after the fix, down from 22 dp.
  • Passed the Robolectric ListBlockquoteMeasurementTest and InlineCodeFormattingTest. The new test checks both measurement layouts against the displayed text view and checks the blockquote spacers.
  • Passed clean patch-package --error-on-fail application, node --test scripts/postinstall-patches.test.mjs, npm run typecheck, npm run lint, and formatting checks.

Checklist

  • One focused change
  • npm run typecheck passes
  • npm run lint passes
  • npm run format passes
  • QA evidence
  • Tests added or updated where it made sense

Use the same span order for Android Markdown measurement and display. Apply list line height before blockquote spacers so nested quotes keep their configured padding and the reply fits above the turn footer.
@paseo-bot

paseo-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Confidence 5/5

No open findings.

Android now applies text spans in the same order when it measures and displays Markdown.

What changes

On Android, assistant replies with blockquotes inside lists now fit above the turn footer and the next message, where they could previously overlap.

  • Blockquote padding and bottom spacing inside lists keep their configured heights, and heading gaps inside lists also keep their configured heights.
  • The app’s test:android command now runs the new Markdown regression tests.

Size

+24/−6 production · +244/−0 tests and fixtures · +110/−6 patch context and headers · +1/−1 package manifest

  • The fix is proportional because it reuses the display wrapper and the existing span priority, while most added lines set up and check the Android regression.
What I verified
  • I traced all four Android measurement layouts, including the paths for fresh and cached text.
  • Both new Robolectric tests passed locally and checked layout height against the native text view.
  • The patch applied to a clean copy of the pinned package, and all five postinstall tests passed locally.
  • The author reported that the overlap disappeared on an Android API 35 emulator after the fix.

Reviews (1) · Last reviewed commit: 14e8908 · Reviewed by Paseo

boudra added a commit that referenced this pull request Nov 23, 2026
… layouts (#10499)

* chore(app): vendor react-native-enriched-markdown with the Paseo patch applied

Copy react-native-enriched-markdown@1.2.0-nightly-20261014-766fc0e67 (upstream
software-mansion/enriched-markdown 766fc0e67) into
packages/react-native-enriched-markdown, with
patches/react-native-enriched-markdown+1.2.0-nightly-20261014-766fc0e67.patch
applied. Nothing else changes in this commit; the package is not a workspace yet.

Reproduce:

  npm pack react-native-enriched-markdown@1.2.0-nightly-20261014-766fc0e67
  tar xzf react-native-enriched-markdown-*.tgz
  mkdir -p t/node_modules && mv package t/node_modules/react-native-enriched-markdown
  (cd t && git init -q && git apply ../patches/react-native-enriched-markdown+*.patch)
  diff -r t/node_modules/react-native-enriched-markdown packages/react-native-enriched-markdown

The diff is empty.

* chore(app): consume react-native-enriched-markdown from its workspace

Make packages/react-native-enriched-markdown a private workspace and point the
app at it, then remove the patch-package patch it replaces.

- package.json: private, version follows the root like every workspace, only the
  postinstall script that downloads tree-sitter grammars. Upstream's
  devDependencies would install a second react-native, so they are gone.
- The package keeps its name, so autolinking, the Gradle project
  :react-native-enriched-markdown, the CocoaPods spec and imports are unchanged.
- Lockfile: drop the nested registry copy under packages/app/node_modules; npm
  links node_modules/react-native-enriched-markdown to the workspace.
- Formatting, lint and knip skip the vendored code. CI routes changes to it
  through the app and browser suites.
- The codegen test checks the vendored package's generated props.
- docs/markdown-renderer.md describes the fork and how to edit it.

* fix(app): keep numbered sub-list markers off their text on Android

From #9964, moved from the package patch into the vendored package.

On Android, a numbered list nested in a bulleted item drew "1." over
the first letters of each item. A nested item's text indent summed the
root list's narrow bullet column with a fixed marginLeft, while its
marker was right-aligned to its own wider "99." column, so the number
landed on the text. iOS already indents from the item's own column.

Backport the Android hunks of upstream enriched-markdown #1015 (size
the number column to the widest marker) and #1023 (nested items start
their text from their own marker column).

test:android now also runs the backported ListRenderingTest and
TaskListInteractionTest suites. docs/markdown-renderer.md lists the
fork's backports, this one and #924, which the removed postinstall
comment used to track.

The vendored tree equals the #9964 patch applied to the pristine
package.

* fix(app): keep Android assistant replies inside their turns

From #10380, moved from the package patch into the vendored package.

On Android, an assistant reply with blockquotes nested inside a list
could overlap its "Worked for ..." footer and the next user message:
the displayed text and the layout measurement applied spans in
different orders, and the list-wide line height inflated the blockquote
spacers when it ran after them.

Use the same span order for Android Markdown measurement and display.
Apply list line height before blockquote spacers so nested quotes keep
their configured padding and the reply fits above the turn footer.

test:android now also runs ListBlockquoteMeasurementTest.

Applied on top of #9964; the two changes share only ListRenderer.kt,
where #10380's import and line-height call sit beside #9964's marker
width code. Every other file equals the #10380 patch applied to the
pristine package.

* chore(app): match the vendored Markdown web block renderer source to its build

The package patch changed lib/module/web/renderers/BlockRenderers.js (the
renderers.codeBlock override and the zoom-in cursor on images) but not
src/web/renderers/BlockRenderers.tsx. The app runs lib, so behavior does
not change. Port both changes into src so src stays the source of lib.
@boudra

boudra commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

superseded by #10499 which is now merged to main.

@boudra boudra closed this Nov 23, 2026
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.

1 participant