summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/traits/list_cursor.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/context/traits/list_cursor.go')
-rw-r--r--pkg/gui/context/traits/list_cursor.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/gui/context/traits/list_cursor.go b/pkg/gui/context/traits/list_cursor.go
index 4e74019ca..e42f1f5e5 100644
--- a/pkg/gui/context/traits/list_cursor.go
+++ b/pkg/gui/context/traits/list_cursor.go
@@ -64,6 +64,21 @@ func (self *ListCursor) SetSelection(value int) {
self.CancelRangeSelect()
}
+func (self *ListCursor) SetSelectionRangeAndMode(selectedIdx, rangeStartIdx int, mode RangeSelectMode) {
+ self.selectedIdx = self.clampValue(selectedIdx)
+ self.rangeStartIdx = self.clampValue(rangeStartIdx)
+ self.rangeSelectMode = mode
+}
+
+// Returns the selectedIdx, the rangeStartIdx, and the mode of the current selection.
+func (self *ListCursor) GetSelectionRangeAndMode() (int, int, RangeSelectMode) {
+ if self.IsSelectingRange() {
+ return self.selectedIdx, self.rangeStartIdx, self.rangeSelectMode
+ } else {
+ return self.selectedIdx, self.selectedIdx, self.rangeSelectMode
+ }
+}
+
func (self *ListCursor) clampValue(value int) int {
clampedValue := -1
if self.list.Len() > 0 {