EditProcessor
Class
Common
class EditProcessor
Helper class to apply EditCommand
s on an internal buffer. Used by TextField Composable to
combine TextFieldValue lifecycle with the editing operations.
- When a
TextFieldValue
is suggested by the developer,reset
should be called. - When
TextInputService
providesEditCommand
s, they should be applied to the internal buffer usingapply
.
Functions
fun reset(value: TextFieldValue, textInputSession: TextInputSession?)
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.
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 | EditCommand s to be applied to the editing buffer. |
Returns
the TextFieldValue representation of the final buffer state. |
fun toTextFieldValue(): TextFieldValue
Returns the current state of the internal editing buffer as a TextFieldValue
.