Skip to content

fix(text): improve effective space width calculation in wrapLine function#128

Merged
chiefcll merged 1 commit into
solid-tv:mainfrom
pecoram:fix/effectivespace-caltulation
Jul 3, 2026
Merged

fix(text): improve effective space width calculation in wrapLine function#128
chiefcll merged 1 commit into
solid-tv:mainfrom
pecoram:fix/effectivespace-caltulation

Conversation

@pecoram

@pecoram pecoram commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@chiefcll chiefcll merged commit 6a41036 into solid-tv:main Jul 3, 2026
3 checks passed
chiefcll added a commit that referenced this pull request Jul 5, 2026
… for #128 (#130)

PR #128 made wrapLine measure the real separator string so multi-space
runs are counted at their true width, but that added a measureText call
per word gap even for the dominant single ' ' case — on the Canvas
backend that's a ctx.measureText per gap during layout. Reuse the
precomputed spaceWidth when the separator is exactly one space and only
measure multi-char runs.

Also adds the unit tests #128 landed without: multi-space separators
wrap at their real width and are preserved when the line fits, ZWSP
runs stay zero-width, and the single-space path uses the precomputed
width.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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