Add a test showing that wrapping text for a view breaks hyperlinks

WrapViewLinesToWidth counts the escape sequences of OSC 8 hyperlinks,
including their URLs, towards the width of a line. It wraps lines with
links too early, and it can even split such an escape sequence across
two lines. Nothing puts links into wrapped popup text yet, but the
update menu will.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan HallerandClaude Opus 5.5 committed 2026-11-15 15:48:30 +01:00
1 parent 54cc6af1d7
commit dfa77684ff
1 file changed
+11
+11
View File
@@ -487,3 +487,14 @@ func TestWrapViewLinesToWidth(t *testing.T) {
})
}
}
func TestWrapViewLinesToWidthWithHyperlink(t *testing.T) {
text := "Hello \x1b]8;;https://example.com\x1b\\big\x1b]8;;\x1b\\ world"
wrappedLines, _, _ := WrapViewLinesToWidth(true, false, text, 9, 4)
assert.Equal(t,
/* EXPECTED:
[]string{"Hello \x1b]8;;https://example.com\x1b\\big\x1b]8;;\x1b\\", "world"},
ACTUAL: */
[]string{"Hello", "\x1b]8;;https:", "//example", ".com\x1b\\big\x1b]8;", ";\x1b\\ world"},
wrappedLines)
}