Skip to content

fix: drop a space chunk that overflows instead of indenting the next line - #9

Merged
halkn merged 2 commits into
mainfrom
fix/wrap-overflowing-space
Aug 10, 2026
Merged

halkn merged 2 commits into
mainfrom
fix/wrap-overflowing-space

Conversation

@halkn

@halkn halkn commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Closes #7

変更理由

改行位置が要求幅ちょうどに落ちると、wrap_spans は溢れた空白 chunk を新しい行の先頭へ運んでいた。flatten は行末の空白しか落とさないため、継続行が 1 桁インデントされ、次の語が行幅ちょうどのときは段落の途中に空行が出ていた。

影響範囲

  • src/layout/wrap.rs — 溢れ判定を先に行い、flush 後に既存の「行頭空白は捨てる」規則へ合流させた。禁則の結合ロジック(chunk())には触れていない
  • golden snapshot 4 件 — 差分はすべて「行頭の空白 1 桁が消えた」のみ

確認手順

  • cargo test --test render / cargo test --test cli — 通過
  • cargo test --bin mdvu — wrap の unit test は追加分含め通過。pager::watch の 2 件はこの変更の前から落ちる既存の失敗(ローカル環境のファイル監視制約)で、CI では通る想定
  • issue の再現手順を --plain --width 38 で確認:
$ mdvu --plain --width 38 w.md
Helpful advice for doing things better
or more easily.

$ mdvu --plain --width 38 w2.md
Helpful advice for doing things better
abcdefghijklmnopqrstuvwxyzabcdefghijkl
end.

@halkn
halkn merged commit 5e7ee32 into main Aug 10, 2026
4 checks passed
@halkn
halkn deleted the fix/wrap-overflowing-space branch August 10, 2026 13:34
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.

wrap: a space chunk that overflows starts the next line instead of being dropped

1 participant