From 4db85b8d2640379cf4dd486d7b766bb9667b5d48 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 13 Dec 2024 15:36:04 +0100 Subject: [PATCH] Pass the view name to the openHyperlink callback --- gui.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui.go b/gui.go index 7caa174..87cc283 100644 --- a/gui.go +++ b/gui.go @@ -130,7 +130,7 @@ type Gui struct { managers []Manager keybindings []*keybinding focusHandler func(bool) error - openHyperlink func(string) error + openHyperlink func(string, string) error maxX, maxY int outputMode OutputMode stop chan struct{} @@ -627,7 +627,7 @@ func (g *Gui) SetFocusHandler(handler func(bool) error) { g.focusHandler = handler } -func (g *Gui) SetOpenHyperlinkFunc(openHyperlinkFunc func(string) error) { +func (g *Gui) SetOpenHyperlinkFunc(openHyperlinkFunc func(string, string) error) { g.openHyperlink = openHyperlinkFunc } @@ -1371,7 +1371,7 @@ func (g *Gui) onKey(ev *GocuiEvent) error { if ev.Key == MouseLeft && !v.Editable && g.openHyperlink != nil { if newY >= 0 && newY <= len(v.viewLines)-1 && newX >= 0 && newX <= len(v.viewLines[newY].line)-1 { if link := v.viewLines[newY].line[newX].hyperlink; link != "" { - return g.openHyperlink(link) + return g.openHyperlink(link, v.name) } } }