diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-06-13 11:01:26 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-08-06 13:49:11 +1000 |
commit | 524bf83a4a681408c3fb57818f6968cab632e0ae (patch) | |
tree | 8858b4ee8d4670dcdd1637fe5fedf00ff080c154 /pkg/gui/controllers/files_controller.go | |
parent | 6dfef08efc5c7f262194c0af35fd777428f33a1a (diff) |
refactor to only have one context per view
Diffstat (limited to 'pkg/gui/controllers/files_controller.go')
-rw-r--r-- | pkg/gui/controllers/files_controller.go | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 5304d0d81..0d2a10b35 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -152,13 +152,31 @@ func (self *FilesController) GetMouseKeybindings(opts types.KeybindingsOpts) []* ViewName: "main", Key: gocui.MouseLeft, Handler: self.onClickMain, - FromContext: string(self.context().GetKey()), + FocusedView: self.context().GetViewName(), + }, + { + ViewName: "patchBuilding", + Key: gocui.MouseLeft, + Handler: self.onClickMain, + FocusedView: self.context().GetViewName(), + }, + { + ViewName: "merging", + Key: gocui.MouseLeft, + Handler: self.onClickMain, + FocusedView: self.context().GetViewName(), }, { ViewName: "secondary", Key: gocui.MouseLeft, Handler: self.onClickSecondary, - FromContext: string(self.context().GetKey()), + FocusedView: self.context().GetViewName(), + }, + { + ViewName: "patchBuildingSecondary", + Key: gocui.MouseLeft, + Handler: self.onClickSecondary, + FocusedView: self.context().GetViewName(), }, } } @@ -318,7 +336,7 @@ func (self *FilesController) press(node *filetree.FileNode) error { return err } - return self.context().HandleFocus() + return self.context().HandleFocus(types.OnFocusOpts{}) } func (self *FilesController) checkSelectedFileNode(callback func(*filetree.FileNode) error) func() error { @@ -349,7 +367,7 @@ func (self *FilesController) getSelectedFile() *models.File { } func (self *FilesController) enter() error { - return self.EnterFile(types.OnFocusOpts{ClickedViewName: "", ClickedViewLineIdx: -1}) + return self.EnterFile(types.OnFocusOpts{ClickedWindowName: "", ClickedViewLineIdx: -1}) } func (self *FilesController) EnterFile(opts types.OnFocusOpts) error { @@ -389,7 +407,7 @@ func (self *FilesController) toggleStagedAll() error { return err } - return self.context().HandleFocus() + return self.context().HandleFocus(types.OnFocusOpts{}) } func (self *FilesController) toggleStagedAllWithLock() error { @@ -828,11 +846,11 @@ func (self *FilesController) handleStashSave(stashFunc func(message string) erro } func (self *FilesController) onClickMain(opts gocui.ViewMouseBindingOpts) error { - return self.EnterFile(types.OnFocusOpts{ClickedViewName: "main", ClickedViewLineIdx: opts.Y}) + return self.EnterFile(types.OnFocusOpts{ClickedWindowName: "main", ClickedViewLineIdx: opts.Y}) } func (self *FilesController) onClickSecondary(opts gocui.ViewMouseBindingOpts) error { - return self.EnterFile(types.OnFocusOpts{ClickedViewName: "secondary", ClickedViewLineIdx: opts.Y}) + return self.EnterFile(types.OnFocusOpts{ClickedWindowName: "secondary", ClickedViewLineIdx: opts.Y}) } func (self *FilesController) fetch() error { |