mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-10-25 05:37:37 +03:00
start moving commit panel handlers into controller
more and more move rebase commit refreshing into existing abstraction and more and more WIP and more handling clicks properly fix merge conflicts update cheatsheet lots more preparation to start moving things into controllers WIP better typing expand on remotes controller moving more code into controllers
This commit is contained in:
@@ -1,22 +1,28 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
|
||||
type BasicContext struct {
|
||||
OnFocus func(opts ...OnFocusOpts) error
|
||||
OnFocus func(opts ...types.OnFocusOpts) error
|
||||
OnFocusLost func() error
|
||||
OnRender func() error
|
||||
// this is for pushing some content to the main view
|
||||
OnRenderToMain func(opts ...OnFocusOpts) error
|
||||
Kind ContextKind
|
||||
Key ContextKey
|
||||
OnRenderToMain func(opts ...types.OnFocusOpts) error
|
||||
Kind types.ContextKind
|
||||
Key types.ContextKey
|
||||
ViewName string
|
||||
WindowName string
|
||||
OnGetOptionsMap func() map[string]string
|
||||
|
||||
ParentContext Context
|
||||
ParentContext types.Context
|
||||
// we can't know on the calling end whether a Context is actually a nil value without reflection, so we're storing this flag here to tell us. There has got to be a better way around this
|
||||
hasParent bool
|
||||
}
|
||||
|
||||
var _ types.Context = &BasicContext{}
|
||||
|
||||
func (self *BasicContext) GetOptionsMap() map[string]string {
|
||||
if self.OnGetOptionsMap != nil {
|
||||
return self.OnGetOptionsMap()
|
||||
@@ -24,12 +30,12 @@ func (self *BasicContext) GetOptionsMap() map[string]string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicContext) SetParentContext(context Context) {
|
||||
func (self *BasicContext) SetParentContext(context types.Context) {
|
||||
self.ParentContext = context
|
||||
self.hasParent = true
|
||||
}
|
||||
|
||||
func (self *BasicContext) GetParentContext() (Context, bool) {
|
||||
func (self *BasicContext) GetParentContext() (types.Context, bool) {
|
||||
return self.ParentContext, self.hasParent
|
||||
}
|
||||
|
||||
@@ -59,7 +65,7 @@ func (self *BasicContext) GetViewName() string {
|
||||
return self.ViewName
|
||||
}
|
||||
|
||||
func (self *BasicContext) HandleFocus(opts ...OnFocusOpts) error {
|
||||
func (self *BasicContext) HandleFocus(opts ...types.OnFocusOpts) error {
|
||||
if self.OnFocus != nil {
|
||||
if err := self.OnFocus(opts...); err != nil {
|
||||
return err
|
||||
@@ -90,10 +96,10 @@ func (self *BasicContext) HandleRenderToMain() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicContext) GetKind() ContextKind {
|
||||
func (self *BasicContext) GetKind() types.ContextKind {
|
||||
return self.Kind
|
||||
}
|
||||
|
||||
func (self *BasicContext) GetKey() ContextKey {
|
||||
func (self *BasicContext) GetKey() types.ContextKey {
|
||||
return self.Key
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user