Skip to content

Hyperlinks don't work properly when the linked text wraps onto the next line #189

Description

@Rylon

Description

If a hyperlink is long enough to wrap onto a second line, the part on the second line is not clickable, it seems TerminalRenderer writes the second row's text without a proper OSC8 open sequence?

In terminal_renderer.go, updatePen() calls ResetHyperlink(), but I noticed it doesn't seem to clear s.cur.Link like the Style branch above it does, could that be the problem?

func (s *TerminalRenderer) updatePen(cell *Cell) {
	if cell == nil {
		if !s.cur.Style.IsZero() {
			_, _ = s.buf.WriteString(ansi.ResetStyle)
			s.cur.Style = Style{} // Reset style
		}
		if !s.cur.Link.IsZero() {
			_, _ = s.buf.WriteString(ansi.ResetHyperlink())
			// should this do the same reset for the link? 
			// for example s.cur.Link = Link{} ?
		}
		return
	}

I found this when working on a Bubble Tea v2 app, where lipgloss was wrapping hyperlinked label over two lines, for now I'm working around it by giving each line's link a different OSC8 ID, which makes the renderer treat it as a new link, but it would be nice for it to be handled upstream if it is indeed a bug?

Thanks! :)

Version

v0.0.0-20260811164956-006e29f97886

Environment

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions