struct TypingContext
Type that contains the context of text. It contains the text as well as the position of the cursor.
| Constructors | |
|---|---|
| TypingContext(context: String) | |
| TypingContext(context: String, cursor: UInt) | |
| TypingContext(context: String, cursorStart: UInt, cursorEnd: UInt) |
| Properties | |
|---|---|
String |
context The text context. |
UInt |
cursorEnd The position of the end of the cursor with respect to the context. |
UInt |
cursorStart The position of the start of the cursor with respect to the context. |
init(context: String)
| Parameters | |
|---|---|
| context: String | The text context. |
init(context: String, cursor: UInt)
Initializes the TypingContext with the cursor position.
Example: “Hello |wrld” => context=“Hello wrld”, cursor=6.
| Parameters | |
|---|---|
| context: String | The text context. |
| cursor: Int | The position of the cursor with respect to the ‘context’. |
init(context: String, cursorStart: UInt, cursorEnd: UInt)
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.
| Parameters | |
|---|---|
| context: String | The text context. |
| cursorStart: Int | The position of the start of the cursor with respect to the context. |
| cursorEnd: Int | The position of the end of the cursor with respect to the context. |
let context: String
The text context.
let cursorEnd: UInt
The position of the end of the cursor with respect to the context. cursorEnd should always be greater than or equal to cursorStart.
let cursorStart: UInt
The position of the start of the cursor with respect to the context.