summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/files_controller.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-02-05 14:42:56 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-17 19:13:40 +1100
commit482bdc4f1ea5448c5e98697ae66221e544ea40dd (patch)
tree7df478f9870e3dddc85f77d7b77439bed16e3c7b /pkg/gui/controllers/files_controller.go
parent8e3484d8e98faf12f8395eaf5f9e8381f77a8e52 (diff)
more refactoring
Diffstat (limited to 'pkg/gui/controllers/files_controller.go')
-rw-r--r--pkg/gui/controllers/files_controller.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go
index c8af30e62..d853ba731 100644
--- a/pkg/gui/controllers/files_controller.go
+++ b/pkg/gui/controllers/files_controller.go
@@ -190,6 +190,21 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
}
}
+func (self *FilesController) GetMouseKeybindings(opts types.KeybindingsOpts) []*gocui.ViewMouseBinding {
+ return []*gocui.ViewMouseBinding{
+ {
+ ViewName: "main",
+ Key: gocui.MouseLeft,
+ Handler: self.onClickMain,
+ },
+ {
+ ViewName: "secondary",
+ Key: gocui.MouseLeft,
+ Handler: self.onClickSecondary,
+ },
+ }
+}
+
func (self *FilesController) press(node *filetree.FileNode) error {
if node.IsLeaf() {
file := node.File
@@ -672,3 +687,13 @@ func (self *FilesController) handleStashSave(stashFunc func(message string) erro
},
})
}
+
+func (self *FilesController) onClickMain(opts gocui.ViewMouseBindingOpts) error {
+ clickedViewLineIdx := opts.Cy + opts.Oy
+ return self.EnterFile(types.OnFocusOpts{ClickedViewName: "main", ClickedViewLineIdx: clickedViewLineIdx})
+}
+
+func (self *FilesController) onClickSecondary(opts gocui.ViewMouseBindingOpts) error {
+ clickedViewLineIdx := opts.Cy + opts.Oy
+ return self.EnterFile(types.OnFocusOpts{ClickedViewName: "secondary", ClickedViewLineIdx: clickedViewLineIdx})
+}