💡 Hard word-break (overflow-wrap) for overlong words
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- c, typescript
- Domain
- cli
Research direction
Start with test/hard-word-break.test.ts, then inspect render_text at src/clayterm.c:269 and the word loop at clay/clay.h:2559-2564. Confirm the opt-in mode splits overlong runs on wcwidth cell boundaries, preserves the requested layout, and leaves default WORDS behavior byte-for-byte identical.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem?
WORDS wrap only breaks at whitespace, so a single word wider than the content box is emitted as one over-wide line that bleeds past the box with no way to break inside it. In a 10-wide bordered box (8 cols of content), "Hellooooooooooooo World" lays out as one long line that spills onto the top-border row entirely outside the box—row 0 prints ┌────────┐oooooooo W while every interior row is blank.
Describe the solution you'd like
An opt-in hard-break mode that mirrors the CSS overflow-wrap property: when a word's measured width exceeds the content width, split at the overflowing cell and continue on the next line until the remainder fits. At width 8, "Hellooooooooooooo World" becomes Helloooo / oooooooo / o World. One extra wrap value or a breakWord flag (exact name TBD):
text("Hellooooooooooooo World", { wrap: 3 }); // WORDS + hard-break
text("Hellooooooooooooo World", { breakWord: true });
Wide runs must split on cell boundaries, not bytes, to stay correct with wcwidth. Default WORDS behavior must stay byte-for-byte identical.
Describe alternatives you've considered
Pre-segmenting overlong runs in JS before text(): unreliable, since it would re-implement wcwidth-aware measurement and need the laid-out content width before layout exists. The break has to happen where the width is known, in the measurement pass.
Additional context
Failing test case on nm/repro/hard-word-break (test · diff). Likely lives in src/clayterm.c:269, where render_text advances x += cw per glyph with no content-width clamp, with the mid-word split landing in Clay's word loop at clay/clay.h:2559-2564.
- Dominant language
- TypeScript
- Stars
- 42
- Forks
- 2
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bombshell-dev/tty
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bombshell-dev/tty#61 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
bombshell-dev/tty#129 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Difficulty 3/5 1-2 days Newbie friendliness 68/100
bombshell-dev/tty#83 · 2 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
bombshell-dev/tty#82 ·
All issues in bombshell-dev/tty
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vicharanashala/fln#563 ·