Method | Description | |
---|---|---|
BeginUpdate ( ) : void |
Begins a group of document changes. Some events are suspended until EndUpdate is called, and the UndoStack will group all changes into a single action. Calling BeginUpdate several times increments a counter, only after the appropriate number of EndUpdate calls the events resume their work. |
|
CreateAnchor ( int offset ) : |
Creates a new TextAnchor at the specified offset.
|
|
CreateDocumentSnapshot ( ) : IDocument | ||
CreateReader ( ) : |
||
CreateReader ( int offset, int length ) : |
||
CreateSnapshot ( ) : ITextSource |
Creates a snapshot of the current text. This method returns an immutable snapshot of the document, and may be safely called even when the document's owner thread is concurrently modifying the document. This special thread-safety guarantee is valid only for TextDocument.CreateSnapshot(), not necessarily for other classes implementing ITextSource.CreateSnapshot().
|
|
CreateSnapshot ( int offset, int length ) : ITextSource |
Creates a snapshot of a part of the current text. |
|
EndUpdate ( ) : void |
Ends a group of document changes. |
|
GetCharAt ( int offset ) : char | ||
GetLineByNumber ( int number ) : |
Gets a line by the line number: O(log n)
|
|
GetLocation ( int offset ) : TextLocation |
Gets the location from an offset.
|
|
GetOffset ( TextLocation location ) : int |
Gets the offset from a text location.
|
|
GetOffset ( int line, int column ) : int |
Gets the offset from a text location.
|
|
GetText ( ISegment segment ) : string |
Retrieves the text for a portion of the document.
|
|
GetText ( int offset, int length ) : string | ||
IndexOf ( char c, int startIndex, int count ) : int | ||
IndexOf ( string searchText, int startIndex, int count, System.StringComparison comparisonType ) : int | ||
IndexOfAny ( char anyOf, int startIndex, int count ) : int | ||
Insert ( int offset, ITextSource text ) : void |
Inserts text. Anchors positioned exactly at the insertion offset will move according to their movement type. For AnchorMovementType.Default, they will move behind the inserted text. The caret will also move behind the inserted text. |
|
Insert ( int offset, ITextSource text, AnchorMovementType defaultAnchorMovementType ) : void |
Inserts text.
|
|
Insert ( int offset, string text ) : void |
Inserts text. Anchors positioned exactly at the insertion offset will move according to their movement type. For AnchorMovementType.Default, they will move behind the inserted text. The caret will also move behind the inserted text. |
|
Insert ( int offset, string text, AnchorMovementType defaultAnchorMovementType ) : void |
Inserts text.
|
|
LastIndexOf ( char c, int startIndex, int count ) : int | ||
LastIndexOf ( string searchText, int startIndex, int count, System.StringComparison comparisonType ) : int | ||
Remove ( ISegment segment ) : void |
Removes text.
|
|
Remove ( int offset, int length ) : void |
Removes text.
|
|
Replace ( ISegment segment, ITextSource text ) : void |
Replaces text.
|
|
Replace ( ISegment segment, string text ) : void |
Replaces text.
|
|
Replace ( int offset, int length, ITextSource text ) : void |
Replaces text.
|
|
Replace ( int offset, int length, ITextSource text, OffsetChangeMap offsetChangeMap ) : void |
Replaces text.
|
|
Replace ( int offset, int length, ITextSource text, OffsetChangeMappingType offsetChangeMappingType ) : void |
Replaces text.
|
|
Replace ( int offset, int length, string text ) : void |
Replaces text.
|
|
Replace ( int offset, int length, string text, OffsetChangeMap offsetChangeMap ) : void |
Replaces text.
|
|
Replace ( int offset, int length, string text, OffsetChangeMappingType offsetChangeMappingType ) : void |
Replaces text.
|
|
RunUpdate ( ) : IDisposable |
Immediately calls BeginUpdate(), and returns an IDisposable that calls EndUpdate(). |
|
SetOwnerThread ( Thread newOwner ) : void |
Transfers ownership of the document to another thread. This method can be used to load a file into a TextDocument on a background thread and then transfer ownership to the UI thread for displaying the document. The owner can be set to null, which means that no thread can access the document. But, if the document has no owner thread, any thread may take ownership by calling SetOwnerThread. |
|
TextDocument ( ) : System |
Create an empty text document.
|
|
TextDocument ( IEnumerable |
Create a new text document with the specified initial text.
|
|
TextDocument ( ITextSource initialText ) : System |
Create a new text document with the specified initial text.
|
|
VerifyAccess ( ) : void |
Verifies that the current thread is the documents owner thread. Throws an InvalidOperationException if the wrong thread accesses the TextDocument. The TextDocument class is not thread-safe. A document instance expects to have a single owner thread and will throw an InvalidOperationException when accessed from another thread. It is possible to change the owner thread using the SetOwnerThread method. |
|
WriteTextTo ( |
||
WriteTextTo ( |
Method | Description | |
---|---|---|
DebugVerifyAccess ( ) : void | ||
DoReplace ( int offset, int length, ITextSource newText, OffsetChangeMap offsetChangeMap ) : void | ||
FireChangeEvents ( ) : void |
Fires TextChanged, TextLengthChanged, LineCountChanged if required.
|
|
GetLineByOffset ( int offset ) : |
||
GetLineTreeAsString ( ) : string | ||
GetTextAnchorTreeAsString ( ) : string | ||
GetTextFromTextSource ( ITextSource textSource ) : IEnumerable |
||
IDocument ( ) : IDisposable | ||
IDocument ( int lineNumber ) : IDocumentLine | ||
IDocument ( int offset ) : ITextAnchor | ||
IDocument ( ) : void | ||
IServiceProvider ( |
||
OnFileNameChanged ( |
||
OnPropertyChanged ( string propertyName ) : void | ||
ThrowIfRangeInvalid ( int offset, int length ) : void |
public CreateAnchor ( int offset ) : |
||
offset | int | |
return |
public CreateDocumentSnapshot ( ) : IDocument | ||
return | IDocument |
public CreateReader ( int offset, int length ) : |
||
offset | int | |
length | int | |
return |
public CreateSnapshot ( int offset, int length ) : ITextSource | ||
offset | int | |
length | int | |
return | ITextSource |
public GetLineByNumber ( int number ) : |
||
number | int | |
return |
public GetLocation ( int offset ) : TextLocation | ||
offset | int | |
return | TextLocation |
public GetOffset ( TextLocation location ) : int | ||
location | TextLocation | |
return | int |
public GetOffset ( int line, int column ) : int | ||
line | int | |
column | int | |
return | int |
public GetText ( int offset, int length ) : string | ||
offset | int | |
length | int | |
return | string |
public IndexOf ( char c, int startIndex, int count ) : int | ||
c | char | |
startIndex | int | |
count | int | |
return | int |
public IndexOf ( string searchText, int startIndex, int count, System.StringComparison comparisonType ) : int | ||
searchText | string | |
startIndex | int | |
count | int | |
comparisonType | System.StringComparison | |
return | int |
public IndexOfAny ( char anyOf, int startIndex, int count ) : int | ||
anyOf | char | |
startIndex | int | |
count | int | |
return | int |
public Insert ( int offset, ITextSource text ) : void | ||
offset | int | The offset at which the text is inserted. |
text | ITextSource | The new text. |
return | void |
public Insert ( int offset, ITextSource text, AnchorMovementType defaultAnchorMovementType ) : void | ||
offset | int | The offset at which the text is inserted. |
text | ITextSource | The new text. |
defaultAnchorMovementType | AnchorMovementType |
/// Anchors positioned exactly at the insertion offset will move according to the anchor's movement type.
/// For AnchorMovementType.Default, they will move according to the movement type specified by this parameter.
/// The caret will also move according to the |
return | void |
public Insert ( int offset, string text ) : void | ||
offset | int | The offset at which the text is inserted. |
text | string | The new text. |
return | void |
public Insert ( int offset, string text, AnchorMovementType defaultAnchorMovementType ) : void | ||
offset | int | The offset at which the text is inserted. |
text | string | The new text. |
defaultAnchorMovementType | AnchorMovementType |
/// Anchors positioned exactly at the insertion offset will move according to the anchor's movement type.
/// For AnchorMovementType.Default, they will move according to the movement type specified by this parameter.
/// The caret will also move according to the |
return | void |
public LastIndexOf ( char c, int startIndex, int count ) : int | ||
c | char | |
startIndex | int | |
count | int | |
return | int |
public LastIndexOf ( string searchText, int startIndex, int count, System.StringComparison comparisonType ) : int | ||
searchText | string | |
startIndex | int | |
count | int | |
comparisonType | System.StringComparison | |
return | int |
public Remove ( int offset, int length ) : void | ||
offset | int | Starting offset of the text to be removed. |
length | int | Length of the text to be removed. |
return | void |
public Replace ( ISegment segment, ITextSource text ) : void | ||
segment | ISegment | |
text | ITextSource | |
return | void |
public Replace ( ISegment segment, string text ) : void | ||
segment | ISegment | |
text | string | |
return | void |
public Replace ( int offset, int length, ITextSource text ) : void | ||
offset | int | The starting offset of the text to be replaced. |
length | int | The length of the text to be replaced. |
text | ITextSource | The new text. |
return | void |
public Replace ( int offset, int length, ITextSource text, OffsetChangeMap offsetChangeMap ) : void | ||
offset | int | The starting offset of the text to be replaced. |
length | int | The length of the text to be replaced. |
text | ITextSource | The new text. |
offsetChangeMap | OffsetChangeMap |
/// The offsetChangeMap determines how offsets inside the old text are mapped to the new text.
/// This affects how the anchors and segments inside the replaced region behave.
/// If you pass null (the default when using one of the other overloads), the offsets are changed as
/// in OffsetChangeMappingType.Normal mode.
/// If you pass OffsetChangeMap.Empty, then everything will stay in its old place
/// (OffsetChangeMappingType.CharacterReplace mode).
/// The offsetChangeMap must be a valid 'explanation' for the document change. See
/// |
return | void |
public Replace ( int offset, int length, ITextSource text, OffsetChangeMappingType offsetChangeMappingType ) : void | ||
offset | int | The starting offset of the text to be replaced. |
length | int | The length of the text to be replaced. |
text | ITextSource | The new text. |
offsetChangeMappingType | OffsetChangeMappingType | /// The offsetChangeMappingType determines how offsets inside the old text are mapped to the new text. /// This affects how the anchors and segments inside the replaced region behave. /// |
return | void |
public Replace ( int offset, int length, string text ) : void | ||
offset | int | The starting offset of the text to be replaced. |
length | int | The length of the text to be replaced. |
text | string | The new text. |
return | void |
public Replace ( int offset, int length, string text, OffsetChangeMap offsetChangeMap ) : void | ||
offset | int | The starting offset of the text to be replaced. |
length | int | The length of the text to be replaced. |
text | string | The new text. |
offsetChangeMap | OffsetChangeMap |
/// The offsetChangeMap determines how offsets inside the old text are mapped to the new text.
/// This affects how the anchors and segments inside the replaced region behave.
/// If you pass null (the default when using one of the other overloads), the offsets are changed as
/// in OffsetChangeMappingType.Normal mode.
/// If you pass OffsetChangeMap.Empty, then everything will stay in its old place
/// (OffsetChangeMappingType.CharacterReplace mode).
/// The offsetChangeMap must be a valid 'explanation' for the document change. See
/// |
return | void |
public Replace ( int offset, int length, string text, OffsetChangeMappingType offsetChangeMappingType ) : void | ||
offset | int | The starting offset of the text to be replaced. |
length | int | The length of the text to be replaced. |
text | string | The new text. |
offsetChangeMappingType | OffsetChangeMappingType | /// The offsetChangeMappingType determines how offsets inside the old text are mapped to the new text. /// This affects how the anchors and segments inside the replaced region behave. /// |
return | void |
public SetOwnerThread ( Thread newOwner ) : void | ||
newOwner | Thread | |
return | void |
public TextDocument ( IEnumerable |
||
initialText | IEnumerable |
|
return | System |
public TextDocument ( ITextSource initialText ) : System | ||
initialText | ITextSource | |
return | System |
public WriteTextTo ( |
||
writer | ||
return | void |
public WriteTextTo ( |
||
writer | ||
offset | int | |
length | int | |
return | void |