Represents a text selection in an editor.
Represents a text selection in an editor.
(active selection)
The position of the cursor. This position might be before or after {@link Selection.anchor anchor}.
Returns: Position
The position of the cursor. This position might be before or after {@link Selection.anchor anchor}. **Returns:** `Position`
(anchor selection)
The position at which the selection starts. This position might be before or after {@link Selection.active active}.
Returns: Position
The position at which the selection starts. This position might be before or after {@link Selection.active active}. **Returns:** `Position`
(contains? selection position-or-range)
Check if a position or a range is contained in this range.
Parameters:
position-or-range
: Range | Position
- A position or a range.Returns: boolean
- true
if the position or range is inside or equal
to this range.
Check if a position or a range is contained in this range. **Parameters:** - `position-or-range`: `Range | Position` - A position or a range. **Returns:** `boolean` - `true` if the position or range is inside or equal to this range.
(empty? selection)
true
if start
and end
are equal.
Returns: boolean
`true` if `start` and `end` are equal. **Returns:** `boolean`
(end selection)
The end position. It is after or equal to {@link Range.start start}.
Returns: Position
The end position. It is after or equal to {@link Range.start start}. **Returns:** `Position`
(equal? selection other)
Check if other
equals this range.
Parameters:
other
: Range
- A range.Returns: boolean
- true
when start and end are {@link Position.isEqualequal} to
start and end of this range.
Check if `other` equals this range. **Parameters:** - `other`: `Range` - A range. **Returns:** `boolean` - `true` when start and end are {@link Position.isEqualequal} to start and end of this range.
(intersection selection range)
Intersect range
with this range and returns a new range or undefined
if the ranges have no overlap.
Parameters:
range
: Range
- A range.Returns: Range | undefined
- A range of the greater start and smaller end positions. Will
return undefined when there is no overlap.
Intersect `range` with this range and returns a new range or `undefined` if the ranges have no overlap. **Parameters:** - `range`: `Range` - A range. **Returns:** `Range | undefined` - A range of the greater start and smaller end positions. Will return undefined when there is no overlap.
(reversed? selection)
A selection is reversed if its {@link Selection.anchor anchor} is the {@link Selection.end end} position.
Returns: boolean
A selection is reversed if its {@link Selection.anchor anchor} is the {@link Selection.end end} position. **Returns:** `boolean`
(set-active! selection value)
The position of the cursor. This position might be before or after {@link Selection.anchor anchor}.
The position of the cursor. This position might be before or after {@link Selection.anchor anchor}.
(set-anchor! selection value)
The position at which the selection starts. This position might be before or after {@link Selection.active active}.
The position at which the selection starts. This position might be before or after {@link Selection.active active}.
(set-is-empty! selection value)
true
if start
and end
are equal.
`true` if `start` and `end` are equal.
(set-is-reversed! selection value)
A selection is reversed if its {@link Selection.anchor anchor} is the {@link Selection.end end} position.
A selection is reversed if its {@link Selection.anchor anchor} is the {@link Selection.end end} position.
(set-is-single-line! selection value)
true
if start.line
and end.line
are equal.
`true` if `start.line` and `end.line` are equal.
(single-line? selection)
true
if start.line
and end.line
are equal.
Returns: boolean
`true` if `start.line` and `end.line` are equal. **Returns:** `boolean`
(start selection)
The start position. It is before or equal to {@link Range.end end}.
Returns: Position
The start position. It is before or equal to {@link Range.end end}. **Returns:** `Position`
(union selection other)
Compute the union of other
with this range.
Parameters:
other
: Range
- A range.Returns: Range
- A range of smaller start position and the greater end position.
Compute the union of `other` with this range. **Parameters:** - `other`: `Range` - A range. **Returns:** `Range` - A range of smaller start position and the greater end position.
(with selection)
(with selection change)
(with selection start)
(with selection start end)
Derived a new range from this range.
Parameters:
change
: { start?: Position | undefined; end?: Position | undefined; }
- An object that describes a change to this range.start
: Position | undefined
- A position that should be used as start. The default value is the {@link Range.start current start}.end
: Position | undefined
- A position that should be used as end. The default value is the {@link Range.end current end}.Returns: Range
- A range that reflects the given change. Will return this
range if the change
is not changing anything.
Derived a new range from this range. **Parameters:** - `change`: `{ start?: Position | undefined; end?: Position | undefined; }` - An object that describes a change to this range. - `start`: `Position | undefined` - A position that should be used as start. The default value is the {@link Range.start current start}. - `end`: `Position | undefined` - A position that should be used as end. The default value is the {@link Range.end current end}. **Returns:** `Range` - A range that reflects the given change. Will return `this` range if the change is not changing anything.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close