Skip to content

text: prevent inline-code fragments from wrapping twice - #3046

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
wabzqem:fix/markdown-inline-code-wrapping
Sep 11, 2026
Merged

text: prevent inline-code fragments from wrapping twice#3046
huacnlee merged 1 commit into
longbridge:mainfrom
wabzqem:fix/markdown-inline-code-wrapping

Conversation

@wabzqem

@wabzqem wabzqem commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Description

Inline code can wrap its final character onto a second line while its background remains on the first line. This reproduces in example-markdown at 100% zoom with asdfwWwwWMMMdmd.

InlineFlow already shapes, wraps, and positions each fragment, but its nested text element can wrap it again when fractional-width rounding leaves a slightly narrower constraint. Apply whitespace_nowrap() to the existing fragment container so wrapping remains owned by InlineFlow. 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)

image

How to Test

Run cargo run -p example-markdown and enter `asdfwWwwWMMMdmd`. The final d should remain with the rest of the token.

Passed:

  • cargo fmt --check
  • cargo test --locked -p gpui-base --lib — 889 tests
  • cargo clippy --locked -p gpui-base --all-targets --all-features -- -D warnings

Checklist

  • Read and followed the contributing guidelines.
  • Reviewed the changes, including generated code, for accuracy.
  • Interactive story validation/screenshot.
  • Windows/Linux validation (not run).

@huacnlee
huacnlee merged commit bfd7244 into longbridge:main Sep 11, 2026
9 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.

2 participants