Skip to content

fix(react): let trailing spaces hang when wrapping text - #869

Merged
Ernxst merged 2 commits into
mainfrom
fix-text-wrapping-860-843
Oct 2, 2026
Merged

Ernxst merged 2 commits into
mainfrom
fix-text-wrapping-860-843

Conversation

@Ernxst

@Ernxst Ernxst commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Harness: Codex
Agent: none
Model: not exposed in the recorded session metadata

Task statements
  1. Fix early line wrapping caused by trailing collapsible spaces in fixed-width cells. (Working-directory and workflow instructions omitted.)
  2. Defer hyphen line breaking where the current breaker needs a broader change to consider a later break opportunity before committing to an earlier space. (Working-directory and workflow instructions omitted.)

Summary

GPU-IX now lets a trailing collapsible space hang past the line box instead of counting it as overflow. The change is in the GPUI line wrapper, pinned from Zed PR #26 and Zed PR #27, at a71fa7f.

#843 remains open. On the 344 px date reproduction GPUI still wraps …Read / 2026-01-01., while Chromium wraps through …Read 2026- / 01-01.. The current line wrapper commits to the preceding space before reaching the later hyphen opportunity; fixing that needs a broader breaker change.

Verification

  • With the old overflow loop, the GPUI regression test failed with left: ["aa", " ", "bb"], expected ["aa ", "bb"]. With the fix, test_trailing_space_does_not_trigger_wrap_before_next_word passes and its line strings are aa / bb.

  • The balanced-wrap GPUI test also passes. Its check now asserts the contract that balanced wrapping chooses a narrower wrap width while preserving the greedy line count; hanging spaces can make the line-width spread equal even when that search works.

  • bun run test in packages/react: 1,948 passed, 16 skipped.

  • A scratch app with packed @gpuix/react and @gpuix/native reproduces the Watchlist row geometry: the Trigger cell is 320 px wide and 64 px tall at 12 px / 16 px. Chromium and GPU-IX both render four lines:

    The well's ~180 split is a chain of combined junctions; any
    Mk.1 pipe or junction on that path caps at 300 m³/min and
    starves the plastic leg unevenly. Any Phase 4 plastic draw
    beyond the Supercomputers would expose the shortfall.
    

    The second line ends and on both sides.

  • In Chromium, Exact and Exact both fit at 29.12396 px. GPU-IX splits both at 29 px (Exac / t) and fits both at 30 px.

  • At 13 px, Chromium lays out aa bb as aa / bb; GPU-IX lays it out as aa / b / b at that probe width. This exposes a separate repeated-space collapsing mismatch in white-space: normal. The GPUI change here only changes overflow accounting for a trailing space at a wrap; collapsing repeated spaces requires a broader text-layout change and is outside Trailing spaces move words to the next line in fixed-width cells #860, so this PR does not claim to fix it.

  • Chromium lays out high-speed as high- / speed; GPU-IX lays it out as high / -spe / ed. This is the deferred GPU-IX does not wrap at hyphens like Chromium #843 behaviour.

  • Both keep -5 on one line and wrap 2026-10-02 as 2026- / 10-02 at the tested width.

  • Chromium's contenteditable case matches the four Watchlist lines; its 320 px textarea reports scrollHeight and clientHeight of 94 px. GPU-IX's 320 × 96 px textarea renders the same four lines, and its source uses the shared shape_text wrapping path.

  • nowrap and pre each remain on one line. GPU-IX does not support whiteSpace: "pre-wrap", so that mode could not be compared.

  • No screenshot goldens changed in the test run.

Closes #860

@Ernxst
Ernxst force-pushed the fix-text-wrapping-860-843 branch from ad62a83 to beba45a Compare October 2, 2026 18:42
@Ernxst
Ernxst force-pushed the fix-text-wrapping-860-843 branch from beba45a to 3607bc0 Compare October 2, 2026 18:58
@Ernxst
Ernxst merged commit 11c9aa2 into main Oct 2, 2026
38 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.

Trailing spaces move words to the next line in fixed-width cells

1 participant