ReadonlymainThe index of the main range in the selection (which is usually the range that was added last).
ReadonlyrangesThe ranges in the selection, sorted by position. Ranges cannot overlap (but they may touch, if they aren't empty).
Get the primary selection range. Usually, you should make sure
your code applies to all ranges, by using methods like
changeByRange.
Extend this selection with an extra range.
Optionalmain: booleanMake sure the selection only has one range. Returns a selection holding only the main range from this selection.
Compare this selection to another selection. By default, ranges
are compared only by position. When includeAssoc is true,
cursor ranges must also have the same
assoc value.
OptionalincludeAssoc: booleanMap a selection through a change. Used to adjust the selection position for changes.
Optionalassoc: numberReplace a given range with another range, and then normalize the selection to merge and sort ranges if necessary.
Optionalwhich: numberConvert this selection to an object that can be serialized to JSON.
StaticcreateSort and merge the given set of ranges, creating a valid selection.
OptionalmainIndex: numberStaticcursorCreate a cursor selection range at the given position. You can safely ignore the optional arguments in most situations.
Optionalassoc: numberOptionalbidiLevel: numberOptionalgoalColumn: numberStaticfromStaticrangeCreate a selection range.
OptionalgoalColumn: numberOptionalbidiLevel: numberOptionalassoc: numberStaticsingleCreate a selection holding a single range.
Optionalhead: number
An editor selection holds one or more selection ranges.