Skip to content

Draw one hyphen where a soft hyphen comes before a visible one [patch] - #165

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/151-soft-hyphen-before-hyphen
Oct 13, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/151-soft-hyphen-before-hyphen

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #151

What changed

For "well-known", ChunkWord closed the chunk "well" at the soft hyphen and then started a new chunk ("-", HyphenBefore: true). A break before that chunk drew the soft hyphen on the upper line and the real hyphen on the lower one, giving "well-" / "-known".

A visible hyphen that arrives straight after a soft hyphen now reopens the chunk the soft hyphen closed. The visible hyphen ends that chunk, and the soft hyphen adds nothing, which is how #135 resolved the opposite order ("-"). The issue suggested gluing the hyphen onto the previous chunk. Reopening the chunk instead also keeps a hyphen run ("well--known") in one piece under the run rules from #156/#159.

Tests

  • NominalWordWrapDoesNotDoubleASoftHyphenFollowedByAVisibleHyphen: "a well-known" at 6 chars gives ["a", "well-", "known"]. On main it gives ["a well-", "-known"].
  • NominalWordWrapKeepsAHyphenRunAfterASoftHyphenTogether and NominalWordWrapDropsASoftHyphenBeforeAVisibleHyphenWhenItFits guard the run and no-break cases. Both already pass on main.

The full suite passes: 196/196 on net10.0.

This PR is independent of #164 (#150). The two touch different functions in the same file.

🤖 Generated with Claude Code

https://claude.ai/code/session_011XTgJFveY9S4CJX3Bzeyej


Generated by Claude Code

"well­-known" closed the chunk "well" at the soft hyphen and then started a
new chunk "-" marked as soft-hyphenated, so a break there drew "well-" over
"-known". A visible hyphen arriving straight after a soft hyphen now reopens
the previous chunk, so the visible hyphen ends it and the soft hyphen adds
nothing: the same resolution #135 used for the opposite order.

Fixes #151

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011XTgJFveY9S4CJX3Bzeyej
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit a5e34c9 into main Oct 13, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/151-soft-hyphen-before-hyphen branch October 13, 2026 08:16
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.

NominalWordWrap still renders a double hyphen ("well-" / "-known") when a soft hyphen comes directly before a visible hyphen (mirror case of #135)

2 participants