From e49fa01ca9abe6dc476c0206a1193a700a136c55 Mon Sep 17 00:00:00 2001 From: marcusDenslow Date: Wed, 20 May 2026 15:12:56 +0200 Subject: [PATCH] feat(tui): use BEL terminator for tracking url osc 8 link - hopefully this works --- pkg/tui/account_orders.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/tui/account_orders.go b/pkg/tui/account_orders.go index 2ed0d61..e9b622c 100644 --- a/pkg/tui/account_orders.go +++ b/pkg/tui/account_orders.go @@ -196,7 +196,7 @@ func (m Model) buildOrderDetailView(order models.Order, _ int) string { b.WriteString("\n") } if order.TrackingURL != "" { - b.WriteString(dimStyle.Render(" " + order.TrackingURL)) + b.WriteString(hyperlink(dimStyle.Render(fmt.Sprintf(" View on %s ->", order.Carrier)), order.TrackingURL)) b.WriteString("\n") } } @@ -248,3 +248,11 @@ func (m Model) displayStyle(k models.DisplayKind) lipgloss.Style { } return m.theme.TextHighlight() } + +// hyperlink wraps label in OSC 8 escape sequences so supporting terminals +// render it as a clickable link to url. Uses BEL (\x07) as the string +// terminator — some renderers in the pipeline (bubbletea/lipgloss) handled +// the BEL form when they didn't handle the ST (\x1b\\) form. +func hyperlink(label, url string) string { + return fmt.Sprintf("\x1b]8;;%s\x07%s\x1b]8;;\x07", url, label) +}