Android 12 Developer Preview is here! Try it out, and give us your feedback!

SetComposingTextCommand

class SetComposingTextCommand : EditCommand
kotlin.Any
   ↳ androidx.compose.ui.text.input.SetComposingTextCommand

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

Summary

Public constructors
<init>(text: String, newCursorPosition: Int)

<init>(annotatedString: AnnotatedString, newCursorPosition: Int)

Replace the currently composing text with the given text, and set the new cursor position.

Public methods
Unit

Apply the command on the editing buffer.

Boolean
equals(other: Any?)

Int

String

Properties
AnnotatedString

The composing text.

Int

The cursor position after setting composing text.

String

Public constructors

<init>

SetComposingTextCommand(
    text: String,
    newCursorPosition: Int)

<init>

SetComposingTextCommand(
    annotatedString: AnnotatedString,
    newCursorPosition: Int)

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

Public methods

applyTo

fun applyTo(buffer: EditingBuffer): Unit

Apply the command on the editing buffer.

equals

fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

toString

fun toString(): String

Properties

annotatedString

val annotatedString: AnnotatedString

The composing text.

newCursorPosition

val newCursorPosition: Int

The cursor position after setting composing text.

text

val text: String