Documentation
¶
Overview ¶
Package selection is the multi-select model behind the grid overview's batch actions: which files are picked, and the anchor a range extension measures from.
It is deliberately just integers. What an index means - a position in the app's file set, not a position in the grid - and which gesture calls which method are internal/ui/grid's business; this package draws nothing and imports no fyne at all, which is why it sits here beside internal/filesort rather than under internal/ui.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a set of file indices plus the anchor a range extension measures from. The zero value is not usable - see New.
func (*Set) Add ¶
Add puts i in the set without moving the anchor - what a range extension walks with, since the anchor is the one end of that range that must not move. A no-op when i is already in.
func (*Set) Anchor ¶
Anchor is the index a range extension measures from, ok=false when neither Toggle nor SetAnchor has happened since the last Clear.
func (*Set) Clear ¶
func (s *Set) Clear()
Clear empties the set and drops the anchor with it: there is nothing left for a range to extend from.
func (*Set) Indices ¶
Indices is the set in ascending order, as a slice the caller owns: the batch actions hold their target list across a background trash move, so it must not alias state a later keystroke can mutate.
func (*Set) Replace ¶
Replace swaps the membership for is, leaving the anchor alone - so a select-all followed by a Shift+click still extends from wherever the user last clicked.