Provides the base requirements for a text change, which contains one or more IText
Properties
CanMergeIntoPreviousChange
Gets whether this text change can merge into the previous text change in the undo stack.
Property Value
- bool:
true
if this text change can merge into the previous text change in the undo stack; otherwise,false
.
CheckReadOnly
Gets whether to prevent the text change from occurring if any text range to modify is flagged as read-only.
Property Value
- bool:
true
if the read-only state should be checked; otherwise,false
.
CustomData
Gets or sets custom data that can be persisted with the text change and restored when undo operations occur later on.
Property Value
- object:
The custom data.
IsMerged
Gets whether this text change is the result of a merge of two or more text changes.
Property Value
- bool:
true
if this text change is the result of a merge of two or more text changes; otherwise,false
.
Remarks
A merge can occur when a text change is created with Can
IsRedo
Gets whether the text change is for a redo.
Property Value
- bool:
true
if the text change is for a redo; otherwise,false
.
IsUndo
Gets whether the text change is for an undo.
Property Value
- bool:
true
if the text change is for an undo; otherwise,false
.
LastTextReplacementOperationIndex
Gets the index of the last operation within the text change in which the entire document text was replaced, if any.
Property Value
- int:
The index of the last text replacement operation within the text change; otherwise,
-1
if there are no such operations.
Operations
Gets the read-only list of IText
Property Value
- IList<IText
Change >:Operation The read-only list of IText
Change objects that make up this text change.Operation
PostSelectionPositionRanges
Gets or sets the collection of sorted non-overlapping Text
Property Value
- IText
Position :Range Collection The collection of sorted non-overlapping Text
Position objects that should be selected in the source view after the text change is applied.Range
PreSelectionPositionRanges
Gets or sets the collection of sorted non-overlapping Text
Property Value
- IText
Position :Range Collection The collection of sorted non-overlapping Text
Position objects that were selected in the source view before the text change is applied.Range
RetainSelection
Gets whether to prevent the caret from moving to the end of the text change in the active view.
Property Value
- bool:
true
if the caret move should be prevented; otherwise,false
.
Snapshot
Gets the IText
Property Value
- IText
Snapshot : The IText
Snapshot against which all operations in this text change should be based.
Source
Gets the optional source of the text change, which is most often an editor view if specified.
Property Value
- object:
The optional source of the text change, which is most often an editor view if specified.
Type
Gets an IText
Property Value
- IText
Change :Type An IText
Change indicating the type of change that was made.Type
Methods
AppendText(string)
Adds an IText
Parameter | Type | Description |
---|---|---|
text | string | The text to append to the end of the Snapshot. |
Remarks
This method is simply a wrapper for a call to Insert
See Also
Apply()
Applies the text change and all of its Operations in sequential order.
Returns
- bool:
true
if all the operations were applied successfully; otherwise,false
.
Apply(ITextPositionRangeCollection, TextRangeTrackingModes)
Applies the text change and all of its Operations in sequential order, also designating the position ranges
that should be translated and set to the Post
Parameter | Type | Description |
---|---|---|
pendingSelectionPositionRanges | IText |
The collection of position ranges that should be converted following the text change. |
translationTrackingModes | Text |
A |
Returns
- bool:
true
if all the operations were applied successfully; otherwise,false
.
Apply(IList<TextRange>, int, TextRangeTrackingModes?)
Applies the text change and all of its Operations in sequential order, also designating the text ranges
that should be converted and set to the Post
Parameter | Type | Description |
---|---|---|
pendingSelectionTextRanges | IList<Text |
The collection of text ranges that should be converted following the text change. |
primaryIndex | int | The index of the primary selection range. |
translationTrackingModes | Text |
When the text range offsets are relative to the previous snapshot and need to be translated to the new snapshot,
this parameter should be set to a non-null |
Returns
- bool:
true
if all the operations were applied successfully; otherwise,false
.
DeleteText(TextRange)
Adds an IText
DeleteText(int, int)
Adds an IText
Parameter | Type | Description |
---|---|---|
offset | int | The starting offset at which to delete. |
deleteLength | int | The number of characters to delete. |
See Also
InsertText(int, string)
Adds an IText
Parameter | Type | Description |
---|---|---|
offset | int | The offset at which to insert. |
text | string | The text to insert. |
See Also
ReplaceText(TextRange, string)
Adds an IText
Parameter | Type | Description |
---|---|---|
textRange | Text |
The Text |
insertText | string | The text to insert. |
See Also
ReplaceText(int, int, string)
Adds an IText
Parameter | Type | Description |
---|---|---|
offset | int | The offset at which to insert. |
deleteLength | int | The number of characters to delete before inserting the text. |
insertText | string | The text to insert. |
See Also
SetText(string)
Adds an IText
Parameter | Type | Description |
---|---|---|
text | string | The text to insert. Pass an empty string to "clear" the document. |
Remarks
A programmatic text replacement means that the undo history will be cleared, and any attached editors will reset the caret to offset 0
.
See Also
SetText(string, bool)
Adds an IText
Parameter | Type | Description |
---|---|---|
text | string | The text to insert. Pass an empty string to "clear" the document. |
isProgrammatic | bool | Whether the operation is considered a programmatic replacement. |
Remarks
A programmatic text replacement means that the undo history will be cleared, and any attached editors will reset the caret to offset 0
.