From dfa77684ffa74b564b201821420babb8ef85a2c8 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 15 Nov 2026 15:48:30 +0100 Subject: [PATCH] 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 --- pkg/utils/lines_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/utils/lines_test.go b/pkg/utils/lines_test.go index da03f8767..f3e5be296 100644 --- a/pkg/utils/lines_test.go +++ b/pkg/utils/lines_test.go @@ -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) +}