mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Set mode to none when calling SetSelectionRangeAndMode with empty non-sticky range
So far, the only situation where we called SetSelectionRangeAndMode was one where the range could only get larger (in startInteractiveRebaseWithEdit, in which case update-ref todos can be inserted by the rebase). However, in the last commit we introduced a new call site where the range can get smaller, including being reduced to a single item. Since this is indistinguishable from a single selection, set the mode to none in this case; without this, hitting escape would seemingly do nothing because it collapses the empty range selection.
This commit is contained in:
parent
0608fc6471
commit
5c56bc7015
1 changed files with 5 additions and 1 deletions
|
@ -65,7 +65,11 @@ func (self *ListCursor) SetSelection(value int) {
|
|||
func (self *ListCursor) SetSelectionRangeAndMode(selectedIdx, rangeStartIdx int, mode RangeSelectMode) {
|
||||
self.selectedIdx = self.clampValue(selectedIdx)
|
||||
self.rangeStartIdx = self.clampValue(rangeStartIdx)
|
||||
self.rangeSelectMode = mode
|
||||
if mode == RangeSelectModeNonSticky && selectedIdx == rangeStartIdx {
|
||||
self.rangeSelectMode = RangeSelectModeNone
|
||||
} else {
|
||||
self.rangeSelectMode = mode
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the selectedIdx, the rangeStartIdx, and the mode of the current selection.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue