ChangeDesc

open class ChangeDesc

A change description is a variant of ChangeSet that doesn't store the inserted text. As such, it can't be applied, but is cheaper to store and manipulate.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

False when there are actual changes in this set.

Link copied to clipboard

Get a description of the inverted form of these changes.

Link copied to clipboard
val length: Int

The length of the document before the change.

Link copied to clipboard

The length of the document after the change.

Functions

Link copied to clipboard

Compute the combined effect of applying another set of changes after this one. The length of the document after this set should match the length before other.

Link copied to clipboard
fun iterChangedRanges(f: (fromA: DocPos, toA: DocPos, fromB: DocPos, toB: DocPos) -> Unit, individual: Boolean = false)

Iterate over the ranges changed by these changes.

Link copied to clipboard
fun iterGaps(f: (posA: DocPos, posB: DocPos, length: Int) -> Unit)

Iterate over the unchanged parts left by these changes. posA provides the position of the range in the old document, posB the new position in the changed document.

Link copied to clipboard
open fun mapDesc(other: ChangeDesc, before: Boolean = false): ChangeDesc

Map this description, which should start with the same document as other, over another set of changes, so that it can be applied after it. When before is true, map as if the changes in this happened before the ones in other.

Link copied to clipboard
fun mapPos(pos: DocPos, assoc: Int = -1): DocPos

Map a given position through these changes, to produce a position pointing into the new document.

fun mapPos(pos: DocPos, assoc: Int, mode: MapMode): DocPos?

Map a given position through these changes. Returns null if the position was deleted according to the given mode.

Link copied to clipboard
fun toJSON(): List<Int>

Serialize this change desc to a JSON-representable value.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun touchesRange(from: DocPos, to: DocPos = from): TouchesResult

Check whether these changes touch a given range. When one of the changes entirely covers the range, the string "cover" is returned.