data class TypingContext
It’s important to note that the cursorStart and cursorEnd refer to the character position of the cursor in the text, as reflected by the following examples (where the character | marks the position(s) of the cursor):
Take into account that these positions do not always match the selectionStart and selectionEnd of the EditText, specially whe there are special characters such as emoji, diacritics, etc.
TypingContext(context: String, cursor: Int)
Initializes the TypingContext with the cursor position.
Example: “Hello |wrld” => context=“Hello wrld”, cursor=6.
TypingContext(context: String, cursorStart: Int, cursorEnd: Int)
Initializes the ‘TypingContext’ allowing a selection of a substring in the text context.
Example: “Hello |wrld|” => context=“Hello wrld”, cursorStart=6, cursorEnd=10. This means that “wrld” is selected.
val context: String
The text context.
var cursorStart: Int = context.length
The position of the start of the cursor with respect to the context.
var cursorEnd: Int = context.length
The position of the end of the cursor with respect to the context. cursorEnd should always be greater than or equal to cursorStart.
If something needs to be added or if you find an error in our documentation, please let us know either on our GitHub or Discord.
Last updated on August 9, 2022