Repository navigation
Markdown: capture inherited text style before InlineFlow measures - #1226
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes bottom clipping of Markdown assistant messages containing
InlineFlowparagraphs (image links, inline images, or inline math), most visibly in compact/mobile layouts.Cause
InlineFlow::request_layoutcalledwindow.text_style(),window.line_height(), andwindow.rem_size()inside itsrequest_measured_layoutclosure (layout_flow/line_ranges). During the initialVirtualizedBlockListColumnLayoutpass, Taffy runs that closure duringcompute_layoutafter ancestorwith_text_style/with_rem_sizescopes (such asassistant'schat_prosewith26pxline height) have already popped.In compact layout (
app-shellsetstypography.mdwith24pxline height),ColumnLayoutmeasured every text-only line in anInlineFlowparagraph 2px short and cached those heights inItemHeights. WhenVirtualizedBlockList::prepaintsubsequently painted the innergpui::listinsidediv::prepaint'swith_text_style(chat_prose), the items laid out at26px, overflowedbounds.bottom(), and were clipped mid-line by the inner list's viewport mask directly above the turn footer.Change
text_style = window.text_style()andrem_size = window.rem_size()duringInlineFlow::request_layoutand pass them intolayout_flow/line_ranges.inline_flow_height_uses_inherited_text_style_inside_virtual_listincrates/ui/src/markdown/view.rscovering aMarkdownViewstyled withchat_proseinside atypography.md-styled outergpui::listat 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: passedcargo machete: passedmbx clippy --workspace --all-targets --locked -- -D warnings: passedmbx nextest run -p tcode-ui --lib --locked -E 'test(/markdown::/)': 33/33 passedmbx 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-ui508/508 passed). The 4 failures are host-environment gaps unrelated to this change:wayland-nest(2 tests):swayis not installed on this hosttcode-traverse(preview/tunnel, 2 tests): loopback listener address unavailable (AddrNotAvailable)