Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#74 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
68/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
c, typescript
領域
cli

調査の方向性

test/hard-word-break.test.ts から始め、次に src/clayterm.c:269 の render_text と clay/clay.h:2559-2564 のワードループを調べてください。オプトインモードが長すぎる連続部分を wcwidth のセル境界で分割し、要求されたレイアウトを維持し、デフォルトの WORDS の動作をバイト単位で完全に同一に保つことを確認してください。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
42
フォーク
2
平均マージ
2日 5時間
マージ済み PR(30日)
12

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bombshell-dev/tty のほかの issue

bombshell-dev/tty の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。