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)

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.

insert(position, text)

Inserts text at the provided character position (Number). This method differs from replace() in that it will automatically move the cursor.