diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-02-05 14:42:56 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 482bdc4f1ea5448c5e98697ae66221e544ea40dd (patch) | |
tree | 7df478f9870e3dddc85f77d7b77439bed16e3c7b /pkg/gui/controllers/files_controller.go | |
parent | 8e3484d8e98faf12f8395eaf5f9e8381f77a8e52 (diff) |
more refactoring
Diffstat (limited to 'pkg/gui/controllers/files_controller.go')
-rw-r--r-- | pkg/gui/controllers/files_controller.go | 25 |
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}) +} |