text: prevent inline-code fragments from wrapping twice - #3046
Merged
huacnlee merged 1 commit intoSep 11, 2026
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.
Description
Inline code can wrap its final character onto a second line while its background remains on the first line. This reproduces in
example-markdownat 100% zoom withasdfwWwwWMMMdmd.InlineFlowalready shapes, wraps, and positions each fragment, but its nested text element can wrap it again when fractional-width rounding leaves a slightly narrower constraint. Applywhitespace_nowrap()to the existing fragment container so wrapping remains owned byInlineFlow. Long code still wraps through the parent flow; font sizes and padding are unchanged.Add a full-Markdown regression that inspects actual painted output rather than caret bounds, which can miss the final-character wrap. The test fails without the production fix and passes with it.
Screenshot
(before above, after below)
How to Test
Run
cargo run -p example-markdownand enter`asdfwWwwWMMMdmd`. The finaldshould remain with the rest of the token.Passed:
cargo fmt --checkcargo test --locked -p gpui-base --lib— 889 testscargo clippy --locked -p gpui-base --all-targets --all-features -- -D warningsChecklist