EditProcessor


Helper class to apply EditCommands on an internal buffer. Used by TextField Composable to combine TextFieldValue lifecycle with the editing operations.

Summary

Public constructors

Cmn

Public functions

TextFieldValue
apply(editCommands: List<EditCommand>)

Applies a set of editCommands to the internal text editing buffer.

Cmn
Unit
reset(value: TextFieldValue, textInputSession: TextInputSession?)

Must be called whenever new editor model arrives.

Cmn
TextFieldValue

Returns the current state of the internal editing buffer as a TextFieldValue.

Cmn

Public constructors

EditProcessor

EditProcessor()

Public functions

apply

fun apply(editCommands: List<EditCommand>): TextFieldValue

Applies a set of editCommands to the internal text editing buffer.

After applying the changes, returns the final state of the editing buffer as a TextFieldValue

Parameters
editCommands: List<EditCommand>

EditCommands to be applied to the editing buffer.

Returns
TextFieldValue

the TextFieldValue representation of the final buffer state.

reset

fun reset(value: TextFieldValue, textInputSession: TextInputSession?): Unit

Must be called whenever new editor model arrives.

This method updates the internal editing buffer with the given editor model. This method may tell the IME about the selection offset changes or extracted text changes.

toTextFieldValue

fun toTextFieldValue(): TextFieldValue

Returns the current state of the internal editing buffer as a TextFieldValue.