Provides the base requirements for an immutable snapshot of an IText
Properties
Document
Gets the IText
Property Value
- IText
Document : The IText
Document for which this snapshot applies.
FooterText
Gets the footer text to append to the end of the snapshot's Text when scanning through the Get
Property Value
Remarks
The use of this property, along with Header
The header and footer sections provide the outer code that surrounds the
'fragment' being edited in the snapshot's Text property.
An example is when editing a method body in a language like C#
.
The Header
See Also
HasContent
Gets whether there is content in the snapshot.
Property Value
- bool:
true
if there is content in the snapshot; otherwise,false
.
Remarks
This property simply checks whether the snapshot has a length greater than 0
.
HeaderText
Gets the header text to append to the start of the snapshot's Text when scanning through the Get
Property Value
Remarks
The use of this property, along with Footer
The header and footer sections provide the outer code that surrounds the
'fragment' being edited in the snapshot's Text property.
An example is when editing a method body in a language like C#
.
The Header
See Also
this[int]
Gets a character in the snapshot.
Parameter | Type | Description |
---|---|---|
index | int | The index of the character to return. |
Property Value
- char:
A character in the snapshot.
Length
Gets the number of characters in the snapshot, excluding any carriage-returns but including newlines.
Property Value
- int:
The number of characters in the snapshot, excluding any carriage-returns but including newlines.
Lines
Gets the collection of IText
Property Value
- IText
Snapshot :Line Collection A IText
Snapshot containing the lines in the snapshot.Line Collection
SnapshotRange
Gets a Text
Property Value
- Text
Snapshot :Range A Text
Snapshot that contains the entire text snapshot.Range
Text
Gets the entire text of the snapshot using Carriage
Property Value
- string:
The entire text of the snapshot using Carriage
Return for line ends.Newline
Remarks
This property should not be used as input for language parsers or taggers since internally for performance reasons,
text is stored with newlines-only as line terminators.
Instead, call Get
The Get
Version
Gets the IText
Property Value
- IText
Version : The IText
Version that specifies the text version represented by the snapshot.
Methods
CreateTextChange(ITextChangeType)
Creates an IText
Parameter | Type | Description |
---|---|---|
type | IText |
An IText |
Returns
- IText
Change : The IText
Change that was created.
Remarks
The IText
CreateTextChange(ITextChangeType, ITextChangeOptions)
Creates an IText
Parameter | Type | Description |
---|---|---|
type | IText |
An IText |
options | IText |
The IText |
Returns
- IText
Change : The IText
Change that was created.
Remarks
The IText
Export(ITextExporter)
Exports the contents of the snapshot to another text format, such as HTML
or RTF
.
Parameter | Type | Description |
---|---|---|
exporter | IText |
The IText |
Returns
- string:
The exported text.
ExportToFile(ITextExporter, string)
Exports the contents of the snapshot to a file in another text format, such as HTML
or RTF
.
Parameter | Type | Description |
---|---|---|
exporter | IText |
The IText |
path | string | The full path of the file of which to save. |
FindAll(ISearchOptions)
Performs a find all operation.
Parameter | Type | Description |
---|---|---|
options | ISearch |
The ISearch |
Returns
- ISearch
Result :Set An ISearch
Result that specifies the result of the operation.Set
FindAll(ISearchOptions, TextRange)
Performs a find all operation over a specific range of the snapshot.
Parameter | Type | Description |
---|---|---|
options | ISearch |
The ISearch |
searchTextRange | Text |
The Text |
Returns
- ISearch
Result :Set An ISearch
Result that specifies the result of the operation.Set
FindNext(ISearchOptions, int, bool)
Performs a find next operation.
Parameter | Type | Description |
---|---|---|
options | ISearch |
The ISearch |
startOffset | int | The offset at which to start the search. |
canWrap | bool | Whether the search can wrap at the end of the search text range. |
Returns
- ISearch
Result :Set An ISearch
Result that specifies the result of the operation.Set
FindNext(ISearchOptions, int, bool, TextRange)
Performs a find next operation over a specific range of the snapshot.
Parameter | Type | Description |
---|---|---|
options | ISearch |
The ISearch |
startOffset | int | The offset at which to start the search. |
canWrap | bool | Whether the search can wrap at the end of the search text range. |
searchTextRange | Text |
The Text |
Returns
- ISearch
Result :Set An ISearch
Result that specifies the result of the operation.Set
FindNext(ISearchOptions, int, bool, TextRange, CancellationToken)
Performs a find next operation over a specific range of the snapshot.
Parameter | Type | Description |
---|---|---|
options | ISearch |
The ISearch |
startOffset | int | The offset at which to start the search. |
canWrap | bool | Whether the search can wrap at the end of the search text range. |
searchTextRange | Text |
The Text |
cancellationToken | Cancellation |
The cancellation token that can abort the search operation. |
Returns
- ISearch
Result :Set An ISearch
Result that specifies the result of the operation.Set
GetMergedBufferReader()
Returns an IText
Returns
- IText
Buffer :Reader An IText
Buffer that allows scanning over a union of the HeaderReader Text , Text, and FooterText .
See Also
GetReader(TextPosition)
Returns an IText
Parameter | Type | Description |
---|---|---|
position | Text |
The Text |
Returns
- IText
Snapshot :Reader An IText
Snapshot that can be used to navigate through the text and token contents of the snapshot.Reader
GetReader(int)
Returns an IText
Parameter | Type | Description |
---|---|---|
offset | int | The offset at which to initialize the reader. |
Returns
- IText
Snapshot :Reader An IText
Buffer that can be used to navigate through the text and token contents of the snapshot.Reader
GetSubstring(TextRange)
Returns a substring from the snapshot text using Carriage
Parameter | Type | Description |
---|---|---|
textRange | Text |
A Text |
Returns
- string:
The substring from the snapshot text using Carriage
Return for line ends.Newline
GetSubstring(TextRange, LineTerminator)
Returns a substring from the snapshot text using the specified Line
Parameter | Type | Description |
---|---|---|
textRange | Text |
A Text |
lineTerminator | Line |
A Line |
Returns
- string:
The substring from the snapshot text using the specified Line
Terminator for line ends.
GetSubstring(int, int)
Returns a substring from the snapshot text using Carriage
Parameter | Type | Description |
---|---|---|
offset | int | The offset at which to retrieve the text. |
length | int | The number of characters to return. |
Returns
- string:
The substring from the snapshot text using Carriage
Return for line ends.Newline
GetSubstring(int, int, LineTerminator)
Returns a substring from the snapshot text using the specified Line
Parameter | Type | Description |
---|---|---|
offset | int | The offset at which to retrieve the text. |
length | int | The number of characters to return. |
lineTerminator | Line |
A Line |
Returns
- string:
The substring from the snapshot text using the specified Line
Terminator for line ends.
GetText(LineTerminator)
Returns the entire text of the snapshot using the specified Line
Parameter | Type | Description |
---|---|---|
lineTerminator | Line |
A Line |
Returns
- string:
The entire text of the snapshot using the specified Line
Terminator for line ends.
Remarks
To retrieve the text in the format expected by a language parser or tagger,
pass Newline as the lineTerminator
parameter.
GetTextStatistics()
Returns an IText
Returns
- IText
Statistics : An IText
Statistics for the snapshot's text.
GetWordText(int)
Gets the text of the word at the specified offset.
Parameter | Type | Description |
---|---|---|
offset | int | The offset to examine. |
Returns
- string:
The text of the word at the specified offset.
GetWordText(int, TextOffsetAffinity)
Gets the text of the word at the specified offset.
Parameter | Type | Description |
---|---|---|
offset | int | The offset to examine. |
affinity | Text |
The Text |
Returns
- string:
The text of the word at the specified offset.
GetWordTextRange(int)
Gets a Text
Parameter | Type | Description |
---|---|---|
offset | int | The offset to examine. |
Returns
GetWordTextRange(int, TextOffsetAffinity)
Gets a Text
Parameter | Type | Description |
---|---|---|
offset | int | The offset to examine. |
affinity | Text |
The Text |
Returns
OffsetToPosition(int)
Returns the Text
Parameter | Type | Description |
---|---|---|
offset | int | The offset of a character within the snapshot. |
Returns
- Text
Position : The Text
Position that represents the specified offset within the text lines.
PositionRangeToTextRange(TextPositionRange)
Returns the Text
Parameter | Type | Description |
---|---|---|
positionRange | Text |
The Text |
Returns
- Text
Range : The Text
Range that represents the specified TextPosition within the snapshot.Range
PositionToOffset(TextPosition)
Returns the offset for the specified Text
Parameter | Type | Description |
---|---|---|
position | Text |
The Text |
Returns
- int:
The offset for the specified Text
Position within the text lines.
TextRangeToPositionRange(TextRange)
Returns the Text
Parameter | Type | Description |
---|---|---|
textRange | Text |
The Text |
Returns
- Text
Position :Range The Text
Position that represents the specified TextRange Range within the snapshot.