Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

💡 Hard word-break (overflow-wrap) for overlong words

Open
#74 1 comment 0 reactions 0 assignees View on GitHub

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

enhancement

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bombshell-dev/tty

All issues in bombshell-dev/tty

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.