# EditCommand

Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/input/EditCommand.kt+class:androidx.compose.ui.text.input.EditCommand) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface EditCommand
  ```
Known direct subclasses [BackspaceCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/BackspaceCommand), [CommitTextCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/CommitTextCommand), [DeleteAllCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteAllCommand), [DeleteSurroundingTextCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteSurroundingTextCommand), [DeleteSurroundingTextInCodePointsCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteSurroundingTextInCodePointsCommand), [FinishComposingTextCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/FinishComposingTextCommand), [MoveCursorCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/MoveCursorCommand), [SetComposingRegionCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingRegionCommand), [SetComposingTextCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand), [SetSelectionCommand](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetSelectionCommand)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/BackspaceCommand` | Represents a backspace operation at the cursor position. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/CommitTextCommand` | Commit final `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/CommitTextCommand#text()` to the text box and set the new cursor position. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteAllCommand` | Deletes all the text in the buffer. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteSurroundingTextCommand` | Delete `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteSurroundingTextCommand#(kotlin.Int,kotlin.Int)` characters of text before the current cursor position, and delete `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteSurroundingTextCommand#(kotlin.Int,kotlin.Int)` characters of text after the current cursor position, excluding the selection. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteSurroundingTextInCodePointsCommand` | A variant of `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/DeleteSurroundingTextCommand`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/FinishComposingTextCommand` | Finishes the composing text that is currently active. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/MoveCursorCommand` | Moves the cursor with `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/MoveCursorCommand#(kotlin.Int)` characters. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingRegionCommand` | Mark a certain region of text as composing text. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand` | Replace the currently composing text with the given text, and set the new cursor position. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetSelectionCommand` | Sets the selection on the text. |

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/EditCommand` is a command representation for the platform IME API function calls. The commands from the IME as function calls are translated into command pattern and used by `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#startInput(androidx.compose.ui.text.input.TextFieldValue,androidx.compose.ui.text.input.ImeOptions,kotlin.Function1,kotlin.Function1)`. For example, as a result of commit text function call by IME `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/CommitTextCommand` is created.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/EditCommand#applyTo(androidx.compose.ui.text.input.EditingBuffer)(buffer: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/EditingBuffer)` Apply the command on the editing buffer. | Cmn |

## Public functions

### applyTo

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun applyTo(buffer: EditingBuffer): Unit
```

Apply the command on the editing buffer.