Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a text selection in an editor.

Hierarchy

Index

Constructors

  • new Selection(anchor: Position, active: Position): Selection
  • new Selection(anchorLine: number, anchorCharacter: number, activeLine: number, activeCharacter: number): Selection

Properties

active: Position

Position of the cursor

anchor: Position

Position where selection starts.

End position.

isEmpty: boolean

true if start and end are equal

isReversed: boolean

A selection is reversed if active.isBefore(anchor)

isSingleLine: boolean

true if start.line and end.line are equal

start: Position

Start position.

Methods

  • isEqual(other: Range): boolean
  • Derived a new range from this range.

    Parameters

    • Optional start: Position

      A position that should be used as start. The default value is the current start.

    • Optional end: Position

      A position that should be used as end. The default value is the current end.

    Returns Range

    A range derived from this range with the given start and end position. If start and end are not different this range will be returned.

  • Derived a new range from this range.

    Parameters

    Returns Range

    A range that reflects the given change. Will return this range if the change is not changing anything.