EditorSelection

An editor selection holds one or more selection ranges.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Get the primary selection range.

Link copied to clipboard

The index of the main range in the selection (which is usually the range that was added last).

Link copied to clipboard

The ranges in the selection, sorted by position. Ranges cannot overlap (but they may touch, if they aren't empty).

Functions

Link copied to clipboard
fun addRange(range: SelectionRange, main: Boolean = true): EditorSelection

Extend this selection with an extra range.

Link copied to clipboard

Make sure the selection only has one range.

Link copied to clipboard
Link copied to clipboard
fun eq(other: EditorSelection, includeAssoc: Boolean): Boolean

Compare this selection to another selection, optionally including cursor association.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun map(change: ChangeDesc, assoc: Int = -1): EditorSelection

Map a selection through a change. Used to adjust the selection position for changes.

Link copied to clipboard
fun replaceRange(range: SelectionRange, which: Int = mainIndex): EditorSelection

Replace a given range with another range, and then normalize the selection to merge and sort ranges if necessary.

Link copied to clipboard

Convert this selection to a serializable EditorSelectionData.

Link copied to clipboard
fun toJSON(): Map<String, Any>

Convert this selection to a JSON object.