TextEditorEdit
A TextEditorEdit
object is used to queue changes within a call to a TextEditor’s edit()
method. Multiple calls to an edit’s methods will be performed atomically to the editor as one operation on the undo stack.
Changes are incurred in the order in which they are invoked on the TextEditorEdit
object. As such, ranges provided to successive calls must ensure they take into account changes in character positions and ranges due to previous edits in the operation.
Methods
delete(range)
Deletes text in the the provided Range.
replace(range, text, [format])
Replaces text in the the provided Range with a new text string. This method differs from insert()
in that it will not move the cursor.
The third argument provided, format
, is an InsertTextFormat
enumeration value defining in what format the text provided should be parsed. This argument was added in Nova 5. Supported values are:
InsertTextFormat.PlainText
: The text is plain text and will not be modified (the default value).InsertTextFormat.Snippet
: The text uses the Snippets format and will be parsed for editor placeholders.
insert(position, text, [format])
Inserts text at the provided character position (Number
). This method differs from replace()
in that it will automatically move the cursor.
The second argument provided, format
, is an InsertTextFormat
enumeration value defining in what format the text provided should be parsed. This argument was added in Nova 5. Supported values are:
InsertTextFormat.PlainText
: The text is plain text and will not be modified (the default value).InsertTextFormat.Snippet
: The text uses the Snippets format and will be parsed for editor placeholders.