Check if iview.context related functions are nil

This commit is contained in:
aditya-K2
2023-04-11 03:06:19 +05:30
parent 79ed0d2608
commit 857810afbb

View File

@@ -82,7 +82,9 @@ func (i *interactiveView) SelectionHandler(selrow int) {
if i.visual {
i.toggleVisualMode()
}
i.contextHandler(i.vrange.Start, i.vrange.End, selrow)
if i.contextHandler != nil {
i.contextHandler(i.vrange.Start, i.vrange.End, selrow)
}
}
func (i *interactiveView) exitVisualMode() {
@@ -183,8 +185,11 @@ func (i *interactiveView) getHandler(s string) func(e *tcell.EventKey) *tcell.Ev
return e
},
"openCtx": func(e *tcell.EventKey) *tcell.EventKey {
i.contextOpener()
return nil
if i.contextOpener != nil {
i.contextOpener()
return nil
}
return e
},
}
if val, ok := funcMap[s]; ok {