Creates a new TextDocument
with the given content and selection.
The index of the anchor of the selection.
The index of the focus of the selection.
The content of the text document.
Whether or not the selection is active.
The total number of lines in the text document.
The line number of the first line of the selection.
The line number of the last line of the selection.
Readonly
anchorThe index of the anchor of the selection.
Readonly
endThe line number of the last line of the selection.
Readonly
focusThe index of the focus of the selection.
Readonly
startThe line number of the first line of the selection.
Readonly
textThe content of the text document.
Readonly
totalThe total number of lines in the text document.
Returns the character immediately after the selection.
The character immediately after the selection.
Returns the character immediately before the selection.
The character immediately before the selection.
Returns the current line number of the cursor.
The current line number of the cursor.
The direction of the selection (or cursor). ->
means the selection is from left to right.
<-
means the selection is from right to left.
TODO: DELETE THIS
A string representing the direction of the selection.
Returns the index of the earliest character in the selection.
The index of the earliest character in the selection.
Returns the text after the selection.
The text after the selection.
Returns the index of the latest character in the selection.
The index of the latest character in the selection.
Returns the text before the selection.
The text before the selection.
Returns the text that is currently selected.
The text that is currently selected.
Returns the type of selection that is currently active. none
means no selection is active.
caret
means a single position is selected. range
means a range of positions is selected.
A string representing the type of selection that is currently active.
Move the selection to the latest index.
A new text document with the selection moved to the latest index.
Move the selection to the earliest index.
A new text document with the selection moved to the earliest index.
Deletes the selection and any text that would be deleted by typing.
A new text document with the selection deleted.
Expands the selection to cover the entire line or lines of the cursor.
A new text document with the selection expanded to cover the entire line or lines of the cursor.
Expands the selection to cover the entire word or words of the cursor.
A new text document with the selection expanded to cover the entire word or words of the cursor.
Inserts text at the selection.
A new text document with the text inserted at the selection.
The text to insert.
Whether to advance the anchor index by the length of the text.
Whether to advance the focus index by the length of the text.
Returns whether the other text document is equal to this one, ignoring the selection.
Whether the other text document is equal to this one, ignoring the selection.
The other text document.
Selects all the text in the document.
A new text document with all the text selected.
Move the selection forward by one character.
A new text document with the selection moved forward by one character.
Move the selection forward by one word.
A new text document with the selection moved forward by one word.
Returns whether the other text document is equal to this one.
Whether the other text document is equal to this one.
The other text document.
Generated using TypeDoc
Text Document
A Text Document is an immutable value type representing a string of text (the text document's content) and a "selection" or "cursor".
The selection (or cursor) is represented by an anchor and a focus index (both are indices into the content string). The anchor index is the index of the side of the selection that was selected first, and the focus index is the side of the selection that was selected last.
You can use the factory methods to produce new Text Document instances with modified content or changed selection.
Text Document methods may be used when developing an Input Processor to create modifications of the original document and return them. See: Processors.