mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +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:
		| @@ -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. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user