mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Clear range select upon pressing 'escape'
This is the highest priority of the escape actions because it's the thing you're most likely to want to do upon hitting escape if you have a range selected. Applying this to the staging/patch-building views is tricky: if we want this logic for when a range of lines is selected, we'll also need to apply it when a hunk is selected too. I still think it's worth it though: I've often accidentally escaped from the staging view when trying to cancel a range selection.
This commit is contained in:
@ -154,5 +154,13 @@ func (self *PatchBuildingController) toggleSelection() error {
|
||||
}
|
||||
|
||||
func (self *PatchBuildingController) Escape() error {
|
||||
context := self.c.Contexts().CustomPatchBuilder
|
||||
state := context.GetState()
|
||||
|
||||
if state.SelectingRange() || state.SelectingHunk() {
|
||||
state.SetLineSelectMode()
|
||||
return self.c.PostRefreshUpdate(context)
|
||||
}
|
||||
|
||||
return self.c.Helpers().PatchBuilding.Escape()
|
||||
}
|
||||
|
Reference in New Issue
Block a user