mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 22:33:07 +02:00
Add proper double-click handling for list views
Previously a click was detected as a double-click whenever the click was on the already selected line, regardless of how long ago the last click was (or even when it wasn't selected by clicking at all). Now that gocui supports proper double-click detection, we can do better.
This commit is contained in:
@ -162,7 +162,6 @@ func (self *ListController) HandleRangeSelectUp() error {
|
||||
}
|
||||
|
||||
func (self *ListController) HandleClick(opts gocui.ViewMouseBindingOpts) error {
|
||||
prevSelectedLineIdx := self.context.GetList().GetSelectedLineIdx()
|
||||
newSelectedLineIdx := self.context.ViewIndexToModelIndex(opts.Y)
|
||||
alreadyFocused := self.isFocused()
|
||||
|
||||
@ -176,7 +175,7 @@ func (self *ListController) HandleClick(opts gocui.ViewMouseBindingOpts) error {
|
||||
|
||||
self.context.GetList().SetSelection(newSelectedLineIdx)
|
||||
|
||||
if prevSelectedLineIdx == newSelectedLineIdx && alreadyFocused && self.context.GetOnClick() != nil {
|
||||
if opts.IsDoubleClick && alreadyFocused && self.context.GetOnClick() != nil {
|
||||
return self.context.GetOnClick()()
|
||||
}
|
||||
self.context.HandleFocus(types.OnFocusOpts{})
|
||||
|
Reference in New Issue
Block a user