OffsetMap

interface OffsetMap
androidx.ui.input.OffsetMap

The map interface used for bidirectional offset mapping from original to transformed text.

Summary

Public methods

abstract Int

Convert offset in original text into the offset in transformed text.

abstract Int

Convert offset in transformed text into the offset in original text.

Companion properties

OffsetMap

The offset map used for identity mapping.

Public methods

originalToTransformed

abstract fun originalToTransformed(offset: Int): Int

Convert offset in original text into the offset in transformed text.

This function must be a monotonically non-decreasing function. In other words, if a cursor advances in the original text, the cursor in the transformed text must advance or stay there.

Parameters
offset: Int offset in original text.
Return
offset in transformed text

transformedToOriginal

abstract fun transformedToOriginal(offset: Int): Int

Convert offset in transformed text into the offset in original text.

This function must be a monotonically non-decreasing function. In other words, if a cursor advances in the transformed text, the cusrsor in the original text must advance or stay there.

Parameters
offset: Int offset in transformed text
Return
offset in original text

Companion properties

identityOffsetMap

val identityOffsetMap: OffsetMap

The offset map used for identity mapping.