Repository navigation
Keep hyphen runs and word-initial hyphens together in NominalWordWrap [patch] - #162
Merged
Merged
Conversation
…WordWrap
ChunkWord ended a chunk after every visible hyphen, so "--" could be split
across lines ("late-" / "-too") and a word-initial hyphen could be left
dangling ("ab -" / "5", "Use the --" / "force"). A visible hyphen is now a
break opportunity only when it ends its run of hyphens and another character
comes before it in the word.
Fixes #156
Fixes #159
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P2fpLkFHYU6nd3JVKufVtK
|
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #156
Fixes #159
What changes
ChunkWordended a chunk after every visible hyphen. Both triage comments say to fix these two issues together, so this PR changes one rule. A visible hyphen is now a break opportunity only when both of these hold:--is never split intolate-/-too-5and--forceare never split after the dashIt was late--too late to callIt was late-/-too late to/callIt was/late--too/late to callab -5ab -/5ab/-5Use the --force flagUse the --/force flagUse the/--force/flagwell-knownandfoo-bar-bazstill break after their hyphens. The soft-hyphen behaviour from #135 and #151 is unchanged, and its existing tests still pass.A hyphen can now stay inside an unbroken chunk, so one guard was added for that case. When a soft hyphen follows a leading
--, a break there no longer adds a third hyphen.Tests
-5-6(a hyphen after a leading one is still a break), and the soft-hyphen guard.🤖 Generated with Claude Code
https://claude.ai/code/session_01P2fpLkFHYU6nd3JVKufVtK
Generated by Claude Code