Skip to content

Pass the view name to the openHyperlink callback #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading