---
title: "CommitTextCommand"
description: "Commit final [text] to the text box and set the new cursor position.

See
[`commitText`](https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#commitText(java.lang.CharSequence,%20int))."
type: "class"
---

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


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

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


```kotlin
class CommitTextCommand(val annotatedString: AnnotatedString, val newCursorPosition: Int) :
    EditCommand
```


Commit final `text` to the text box and set the new cursor position.

See
``commitText``(https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#commitText(java.lang.CharSequence,%20int)).

#### Parameters

| | |
| --- | --- |
| annotatedString | The text to commit. |
| newCursorPosition | The cursor position after inserted text. |



## Secondary Constructors

```kotlin
constructor(
    /** The text to commit. We ignore any styles in the original API. */
    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
```



