StyledTextDocument
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.
The highlighted ranges. This is publicly mutable, which means you can add/remove highlights without going through the history mechanism. (e.g. to add highlights text which matches a search
).
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 StyledTextChange which adds a range on redo, and removes it again on undo.
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.
Returns a StyledTextChange which remove a range on redo, and adds it again on undo.
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 :