Skip to content

Markdown: capture inherited text style before InlineFlow measures - #1226

Merged
Tryanks merged 1 commit into
Tryanks:mainfrom
ClanEver:fix/inline-flow-text-style
Dec 4, 2026
Merged

Tryanks merged 1 commit into
Tryanks:mainfrom
ClanEver:fix/inline-flow-text-style

Conversation

@EverClan

@EverClan EverClan commented Dec 4, 2026

Copy link
Copy Markdown

Summary

Fixes bottom clipping of Markdown assistant messages containing InlineFlow paragraphs (image links, inline images, or inline math), most visibly in compact/mobile layouts.

Cause

InlineFlow::request_layout called window.text_style(), window.line_height(), and window.rem_size() inside its request_measured_layout closure (layout_flow / line_ranges). During the initial VirtualizedBlockList ColumnLayout pass, Taffy runs that closure during compute_layout after ancestor with_text_style / with_rem_size scopes (such as assistant's chat_prose with 26px line height) have already popped.

In compact layout (app-shell sets typography.md with 24px line height), ColumnLayout measured every text-only line in an InlineFlow paragraph 2px short and cached those heights in ItemHeights. When VirtualizedBlockList::prepaint subsequently painted the inner gpui::list inside div::prepaint's with_text_style(chat_prose), the items laid out at 26px, overflowed bounds.bottom(), and were clipped mid-line by the inner list's viewport mask directly above the turn footer.

Change

  • Capture text_style = window.text_style() and rem_size = window.rem_size() during InlineFlow::request_layout and pass them into layout_flow / line_ranges.
  • Add inline_flow_height_uses_inherited_text_style_inside_virtual_list in crates/ui/src/markdown/view.rs covering a MarkdownView styled with chat_prose inside a typography.md-styled outer gpui::list at phone width (fails before the fix with the closing paragraph clipped out of the painted viewport; passes after).

Checks run (Linux x86_64, Rust 1.100.1)

  • cargo fmt --all --check: passed
  • cargo machete: passed
  • mbx clippy --workspace --all-targets --locked -- -D warnings: passed
  • mbx nextest run -p tcode-ui --lib --locked -E 'test(/markdown::/)': 33/33 passed
  • mbx nextest run --workspace --locked --no-fail-fast -E 'not test(=claude::tests::a_session_previews_rewinds_and_reports_the_part_claude_refused)': 1543/1547 passed (tcode-ui 508/508 passed). The 4 failures are host-environment gaps unrelated to this change:
    • wayland-nest (2 tests): sway is not installed on this host
    • tcode-traverse (preview / tunnel, 2 tests): loopback listener address unavailable (AddrNotAvailable)
  • iOS/Android/Web cross-target builds were not run locally.

@Tryanks
Tryanks merged commit bee52d4 into Tryanks:main Dec 4, 2026
13 checks passed
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.

3 participants