Documentation
¶
Overview ¶
Package textselect is what the Windows and Linux backends share of a selection across the texts of an area (driver.SelectionModel): the texts as the model reads them, hit-tested through their layouts.
Index ¶
- func AreaAt[V any](under []V, taker func(V) Taker) (area V, ok bool)
- type Selection
- func (s *Selection) Content(i int) string
- func (s *Selection) Frame(i int) driver.Bounds
- func (s *Selection) Key(i int) uint64
- func (s *Selection) Len() int
- func (s *Selection) OffsetAt(i int, p driver.Point) int
- func (s *Selection) Ranges() map[driver.NodeID]driver.SelectionRange
- func (s *Selection) Selected() []driver.SelectedRange
- func (s *Selection) Spans(i int) []driver.TextSpan
- func (s *Selection) Tell(origin driver.Point, cleared bool) (driver.Event, bool)
- type Taker
- type Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Selection ¶
type Selection struct {
Area driver.NodeID
Texts []Text
Model driver.SelectionModel
Dragging bool
Told driver.Bounds
ToldText string
// ToldRanges are the per-text ranges the area last reported: a
// selection whose text and extent stay, such as the same words on
// another text, still reports anew.
ToldRanges []driver.SelectedRange
}
Selection is the selection of one area: the model over the area's texts, listed again before each use, and whether the pointer that started it is still down.
func (*Selection) Ranges ¶
func (s *Selection) Ranges() map[driver.NodeID]driver.SelectionRange
Ranges returns what each text, by its ID, has selected.
func (*Selection) Selected ¶
func (s *Selection) Selected() []driver.SelectedRange
Selected returns what each text has selected, by its node, in document order: what EventSelectionChange's Ranges carries.
func (*Selection) Tell ¶
Tell returns the event reporting the selection's text, per-text ranges and extent to its area, the extent at origin in the coordinates of its texts' boxes; false when none changed, as the extent stays while the selection moves within one text. A cleared selection reports none.
type Taker ¶
type Taker uint8
Taker is what a view under a press is to a selection.
const ( // Passes lets the press go on to the views around. Passes Taker = iota // Keeps takes the press itself: a field, a page, a pressable view or // one that follows pans. Keeps // Area is a selection area: a view with SelectionArea. Area // SelectableText is a text with SelectableOn outside any area. SelectableText )