# SetComposingTextCommand

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.SetComposingTextCommand) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  class SetComposingTextCommand : EditCommand
  ```

*** ** * ** ***

Replace the currently composing text with the given text, and set the new cursor position. Any composing text set previously will be removed automatically.

See [`setComposingText`](https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#setComposingText(java.lang.CharSequence,%2520int)).

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#SetComposingTextCommand(androidx.compose.ui.text.AnnotatedString,kotlin.Int)( annotatedString: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString, newCursorPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#SetComposingTextCommand(kotlin.String,kotlin.Int)(text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, newCursorPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#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 |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#hashCode()()` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#annotatedString()` The composing text. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#newCursorPosition()` The cursor position after setting composing text. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/SetComposingTextCommand#text()` | Cmn |

## Public constructors

### SetComposingTextCommand

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

```
SetComposingTextCommand(
    annotatedString: AnnotatedString,
    newCursorPosition: Int
)
```

| Parameters |
|---|---|
| `annotatedString: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | The composing text. |
| `newCursorPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The cursor position after setting composing text. |

### SetComposingTextCommand

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

```
SetComposingTextCommand(text: String, newCursorPosition: Int)
```

## Public functions

### applyTo

Cmn

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

Apply the command on the editing buffer.

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### annotatedString

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

```
val annotatedString: AnnotatedString
```

The composing text.

### newCursorPosition

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

```
val newCursorPosition: Int
```

The cursor position after setting composing text.

### text

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

```
val text: String
```