Selection

open class Selection : Range(source)

Represents a text selection in an editor.

Online Documentation

Constructors

Link copied to clipboard
constructor(anchor: Position, active: Position)

Create a selection from two positions.

constructor(anchorLine: Int, anchorCharacter: Int, activeLine: Int, activeCharacter: Int)

Create a selection from four coordinates.

Properties

Link copied to clipboard

The position of the cursor. This position might be before or after anchor.

Link copied to clipboard

The position at which the selection starts. This position might be before or after active.

Link copied to clipboard

The end position. It is after or equal to start.

Link copied to clipboard

true if start and end are equal.

Link copied to clipboard

A selection is reversed if its anchor} is the {@link Selection.end end position.

Link copied to clipboard

true if start.line and end.line are equal.

Link copied to clipboard

The start position. It is before or equal to end.

Functions

Link copied to clipboard
fun contains(positionOrRange: JsAny): Boolean

Check if a position or a range is contained in this range.

Link copied to clipboard
fun intersection(range: Range): Range?

Intersect range with this range and returns a new range or undefined if the ranges have no overlap.

Link copied to clipboard
fun isEqual(other: Range): Boolean

Check if other equals this range.

Link copied to clipboard
fun union(other: Range): Range

Compute the union of other with this range.

Link copied to clipboard
fun with(start: Position = definedExternally, end: Position = definedExternally): Range

Derived a new range from this range.