TextDocument
The HistoryDocument used by TextArea. The document is stored as a List of String, where each String must NOT include new line character.
An empty document is NOT an empty list. It is a list containing a single blank string. You may safely assume that lines is never an empty list.
Changes related to a TextDocument are subclasses of TextChange. There are only 2 DeleteText and InsertText. Replacements are comprised of a DeleteText followed by an InsertText within a single Batch. As such, undo/redo will never split them; they appear to be atomic.
NOTE. Changes to the caret/anchor positions of a TextArea are not part of a TextDocument, they are part of the TextArea. Therefore, you cannot undo/redo changes to the caret/anchor positions.
Inheritors
Properties
The text is held as an array of lines. This makes editing the text much more efficient than using one huge String (with new-line characters). New line characters are NOT included in the list elements.
TextDocument does NOT store the document as a String, it is stored as a list of strings where each item in the list does NOT contain a new line character.
Functions
Returns a TextChange object, but does not apply that change. Useful for batching multiple changes together so that undo/redo treats them as a single step.
Returns a TextChange object, but does not apply that change. Useful for batching multiple changes together so that undo/redo treats them as a single step.
Returns a TextChange object, but does not apply that change. Useful for batching multiple changes together so that undo/redo treats them as a single step.
If pos is a valid TextPosition for this document, it is returned (unchanged). Otherwise, a new TextPosition is returned, which is valid. The row is in the range :