What's wrong
#135 fixed a double hyphen for a soft hyphen that comes after a visible hyphen ("-"). The fix is the chunks[^1].Text[^1] != '-' guard in ChunkWord (commit 3a061d8). The opposite order, "-", still renders two hyphens.
Trace for "well-known" through ChunkWord (Extensions/StringExtensions.cs lines ~365–397 at 197654d):
- The soft hyphen closes the chunk
"well" and sets hyphenBefore = true.
- The next character,
'-', forms its own chunk ("-", HyphenBefore: true).
- When the wrap breaks before that chunk,
NominalWordWrap appends a '-' to the upper line for the soft hyphen (line ~295). The lower line then starts with the real hyphen.
Reproduction (observed on net10.0)
"a well-known".NominalWordWrap(6f, 1f);
// actual: ["a well-", "-known"]
// compare: "a well-known" -> ["a", "well-", "known"]
// "a well-known" -> ["a", "well-", "known"] (#135 order, fixed)
// expected: one visible hyphen, e.g. ["a", "well-", "known"]
Why it matters
The docs promise two things: a soft hyphen renders only when a break lands on it, and a break after a visible hyphen keeps the hyphen on the upper line. Here both rules fire at once, and the reader sees "well-" followed by "-known". Soft hyphens next to real hyphens are common in output from automatic hyphenators and in pasted text.
Suggested fix / acceptance criteria
What's wrong
#135 fixed a double hyphen for a soft hyphen that comes after a visible hyphen (
"-"). The fix is thechunks[^1].Text[^1] != '-'guard inChunkWord(commit 3a061d8). The opposite order,"-", still renders two hyphens.Trace for
"well-known"throughChunkWord(Extensions/StringExtensions.cslines ~365–397 at 197654d):"well"and setshyphenBefore = true.'-', forms its own chunk("-", HyphenBefore: true).NominalWordWrapappends a'-'to the upper line for the soft hyphen (line ~295). The lower line then starts with the real hyphen.Reproduction (observed on net10.0)
Why it matters
The docs promise two things: a soft hyphen renders only when a break lands on it, and a break after a visible hyphen keeps the hyphen on the upper line. Here both rules fire at once, and the reader sees "well-" followed by "-known". Soft hyphens next to real hyphens are common in output from automatic hyphenators and in pasted text.
Suggested fix / acceptance criteria
ChunkWord, handle'-'arriving whilecurrentis empty andhyphenBeforeis true: glue the hyphen onto the previous chunk and clear the flag."a well-known".NominalWordWrap(6f, 1f)produces exactly one visible hyphen.