1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Support non-sticky range selection in patch explorer views

This commit is contained in:
Jesse Duffield
2024-01-11 10:34:05 +11:00
parent 24a4302c52
commit c0c3aac02e
3 changed files with 96 additions and 6 deletions

View File

@ -56,6 +56,18 @@ func (self *PatchExplorerController) GetKeybindings(opts types.KeybindingsOpts)
Key: opts.GetKey(opts.Config.Universal.NextItem),
Handler: self.withRenderAndFocus(self.HandleNextLine),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.RangeSelectUp),
Handler: self.withRenderAndFocus(self.HandlePrevLineRange),
Description: self.c.Tr.RangeSelectUp,
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.RangeSelectDown),
Handler: self.withRenderAndFocus(self.HandleNextLineRange),
Description: self.c.Tr.RangeSelectDown,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
Handler: self.withRenderAndFocus(self.HandlePrevHunk),
@ -177,6 +189,22 @@ func (self *PatchExplorerController) HandleNextLine() error {
return nil
}
func (self *PatchExplorerController) HandlePrevLineRange() error {
s := self.context.GetState()
s.CycleRange(false)
return nil
}
func (self *PatchExplorerController) HandleNextLineRange() error {
s := self.context.GetState()
s.CycleRange(true)
return nil
}
func (self *PatchExplorerController) HandlePrevHunk() error {
self.context.GetState().CycleHunk(false)
@ -190,7 +218,7 @@ func (self *PatchExplorerController) HandleNextHunk() error {
}
func (self *PatchExplorerController) HandleToggleSelectRange() error {
self.context.GetState().ToggleSelectRange()
self.context.GetState().ToggleStickySelectRange()
return nil
}