Skip to main content

Module selection

Module selection 

Source
Expand description

One selection model for everything (0014 wave 2): normal mode is a collapsed selection, visual mode is a stretched one, multicursor is several. Cursor / anchor / extra-cursors used to be three fields that could disagree; the set owns them with the invariants in one place.

Structs§

Selection
One selection: the anchor sits, the head moves. Collapsed (equal) is a cursor. Byte offsets, always char boundaries.
SelectionSet
The editor’s selections: a primary plus zero or more extras. Invariants (enforced by normalize): extras sorted, deduped, none equal to the primary’s head.