mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-17 01:42:45 +02:00
Remove GetOnRenderToMain, GetOnFocus, and GetOnFocusLost from BaseContext
These are never called on the context, they only exist to satisfy the HasKeybindings interface. But that's wrong, HasKeybindings has nothing to do with focus handling or rendering the main view. Remove them from that interface and add them to IController instead.
This commit is contained in:
@ -166,30 +166,18 @@ func (self *BaseContext) AddOnRenderToMainFn(fn func()) {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *BaseContext) GetOnRenderToMain() func() {
|
||||
return self.onRenderToMainFn
|
||||
}
|
||||
|
||||
func (self *BaseContext) AddOnFocusFn(fn onFocusFn) {
|
||||
if fn != nil {
|
||||
self.onFocusFn = fn
|
||||
}
|
||||
}
|
||||
|
||||
func (self *BaseContext) GetOnFocus() onFocusFn {
|
||||
return self.onFocusFn
|
||||
}
|
||||
|
||||
func (self *BaseContext) AddOnFocusLostFn(fn onFocusLostFn) {
|
||||
if fn != nil {
|
||||
self.onFocusLostFn = fn
|
||||
}
|
||||
}
|
||||
|
||||
func (self *BaseContext) GetOnFocusLost() onFocusLostFn {
|
||||
return self.onFocusLostFn
|
||||
}
|
||||
|
||||
func (self *BaseContext) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding {
|
||||
bindings := []*gocui.ViewMouseBinding{}
|
||||
for i := range self.mouseKeybindingsFns {
|
||||
|
@ -245,14 +245,15 @@ type HasKeybindings interface {
|
||||
GetMouseKeybindings(opts KeybindingsOpts) []*gocui.ViewMouseBinding
|
||||
GetOnClick() func() error
|
||||
GetOnClickFocusedMainView() func(mainViewName string, clickedLineIdx int) error
|
||||
GetOnRenderToMain() func()
|
||||
GetOnFocus() func(OnFocusOpts)
|
||||
GetOnFocusLost() func(OnFocusLostOpts)
|
||||
}
|
||||
|
||||
type IController interface {
|
||||
HasKeybindings
|
||||
Context() Context
|
||||
|
||||
GetOnRenderToMain() func()
|
||||
GetOnFocus() func(OnFocusOpts)
|
||||
GetOnFocusLost() func(OnFocusLostOpts)
|
||||
}
|
||||
|
||||
type IList interface {
|
||||
|
Reference in New Issue
Block a user