K3TextRange

class K3TextRange(val start: Int, val end: Int)(source)

A selection range from start to end in a text.

There is no restriction to the values nor ordering of start and end. It may happen that start > end, and that is perfectly fine. If ordering is important, min and max should be used.

If start == end, then this range represents a collapsed selection (commonly known as cursor).

Constructors

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

Shorthand constructor for creating a text range from a single cursor index.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val end: Int

The end index of the selection.

Link copied to clipboard
val max: Int

The maximum of start and end, represents the exclusive max index in the text.

Link copied to clipboard
val min: Int

The minimum of start and end, represents the inclusive min index in the text.

Link copied to clipboard
val start: Int

The start index of the selection.

Functions

Link copied to clipboard

Returns this range as a Kotlin IntRange.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Returns true if this range represents a collapsed selection (commonly known as cursor).

Link copied to clipboard

Returns true if this range represents a non-collapsed selection (commonly known as selection).

Link copied to clipboard
operator fun minus(value: Int): K3TextRange

Returns a new text range with given value subtracted to both start and end.

Link copied to clipboard
operator fun plus(value: Int): K3TextRange

Returns a new text range with given value added to both start and end.

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

Returns the string representation of this range for debug purposes.