EditProcessor
Class
Common
class EditProcessor
Helper class to apply EditCommands on an internal buffer. Used by TextField Composable to
combine TextFieldValue lifecycle with the editing operations.
- When a
TextFieldValueis suggested by the developer,resetshould be called. - When
TextInputServiceprovidesEditCommands, 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 | EditCommands 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.
