SelectionRange

A single selection range. When allowMultipleSelections is enabled, a selection may hold multiple ranges. By default, selections hold exactly one range.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The anchor of the range—the side that doesn't move.

Link copied to clipboard
val assoc: Int

If this is a cursor that is explicitly associated with the character on one of its sides, this returns the side. -1 means the character before its position, 1 the character after, and 0 means no association.

Link copied to clipboard

The bidirectional text level associated with this cursor, if any.

Link copied to clipboard

True when anchor and head are at the same position.

Link copied to clipboard

The lower boundary of the range.

Link copied to clipboard

The goal column associated with a cursor.

Link copied to clipboard

The head of the range, which is moved when extended.

Link copied to clipboard
val to: DocPos

The upper boundary of the range.

Functions

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

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

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun extend(from: DocPos, to: DocPos = from): SelectionRange

Extend this range to cover at least from to to.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun map(change: ChangeDesc, assoc: Int = -1): SelectionRange

Map this range through a change, producing a valid range in the updated document.

Link copied to clipboard

Convert this range to a serializable SelectionRangeData.

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

Return a JSON-serializable object representing the range.