Skip to content

Commit

Permalink
Merge pull request #70 from jesseduffield/pass-view-name-to-open-hype…
Browse files Browse the repository at this point in the history
…rlink-callback

Pass the view name to the openHyperlink callback
  • Loading branch information
stefanhaller authored Jan 7, 2025
2 parents 164661a + 4db85b8 commit 716b1eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit 716b1eb

Please sign in to comment.