mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Add SetSelection function for list contexts and use it in most places
The only time we should call SetSelectedLineIdx is when we are happy for a select range to be retained which means things like moving the selected line index to top top/bottom or up/down a page as the user navigates. But in every other case we should now call SetSelection because that will set the selected index and cancel the range which is almost always what we want.
This commit is contained in:
parent
8840c1a2b7
commit
54bd94ad24
27 changed files with 54 additions and 35 deletions
|
@ -160,7 +160,7 @@ func (self *ListController) HandleClick(opts gocui.ViewMouseBindingOpts) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
self.context.GetList().SetSelectedLineIdx(newSelectedLineIdx)
|
||||
self.context.GetList().SetSelection(newSelectedLineIdx)
|
||||
|
||||
if prevSelectedLineIdx == newSelectedLineIdx && alreadyFocused && self.context.GetOnClick() != nil {
|
||||
return self.context.GetOnClick()()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue