text: fix zero-width truncated newline rune accounting

This commit fixes another rune accounting issue that only existed when shaping
a solitary newline with zero width while truncating the line.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-08-02 10:32:14 -04:00
parent 80da4d6b02
commit 341978dbcd
2 changed files with 31 additions and 13 deletions
+13
View File
@@ -484,6 +484,19 @@ func TestShapeStringRuneAccounting(t *testing.T) {
MaxWidth: 999929,
},
},
{
name: "newline zero-width regression",
input: "\n",
params: Parameters{
Font: font.Font{Typeface: "Go", Style: font.Regular, Weight: font.Normal},
Alignment: Start,
PxPerEm: 768,
MaxLines: 1,
Truncator: "\u200b",
WrapPolicy: WrapHeuristically,
MaxWidth: 0,
},
},
} {
t.Run(tc.name, func(t *testing.T) {
for _, setup := range []setup{