feat(tui): use BEL terminator for tracking url osc 8 link - hopefully this works

This commit is contained in:
2026-05-20 15:12:56 +02:00
parent d9e9895913
commit e49fa01ca9

View File

@@ -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)
}