TextRange

value class TextRange

A range of characters in a text document, expressed as a directional anchor(start)/caret(end) pair of offsets.

start is the fixed anchor of a selection and end is the moving caret, so a range where start != end is directional: TextRange(2, 5) anchors at 2 with the caret at 5, while TextRange(5, 2) anchors at 5 with the caret at 2. A range where start equals end is a collapsed caret at that offset with no selected text.

Constructors

Link copied to clipboard
constructor(start: Int, end: Int)

Properties

Link copied to clipboard
val end: Int

The caret offset of this range.

Link copied to clipboard
val start: Int

The anchor offset of this range.

Functions

Link copied to clipboard
open override fun toString(): String