---
title: "SetComposingTextCommand"
description: "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))."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
class SetComposingTextCommand(val annotatedString: AnnotatedString, val newCursorPosition: Int) :
    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)).

#### Parameters

| | |
| --- | --- |
| annotatedString | The composing text. |
| newCursorPosition | The cursor position after setting composing text. |



## Secondary Constructors

```kotlin
constructor(
    /** The composing text. */
    text: String,
    /** The cursor position after setting composing text. */
    newCursorPosition: Int,
) : this(AnnotatedString(text), newCursorPosition)
```

## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val text: String
```



