TextChangeEventArgs Class
Definition
The net text change of one operation, raised by Avalonia.Controls.Documents.TextModel.TextDocument.TextChanged when the operation's outermost Avalonia.Controls.Documents.TextModel.TextDocument.BeginChange scope closes: the text at Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset that was Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.OldLength characters long is now Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.NewLength characters long.
public class TextChangeEventArgs
Properties
| Name | Description |
|---|---|
| InsertedText | Gets the text at [Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset, Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset + Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.NewLength) right after the change. Empty for pure deletions. |
| Kind | Gets the kind of change (Insert, Delete, or Replace). |
| NewLength | Gets the length of text that was inserted (0 for pure deletions). |
| Offset | Gets the offset where the change occurred. |
| OldLength | Gets the length of text that was deleted (0 for pure insertions). |
InsertedText Property
Gets the text at [Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset, Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.Offset + Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.NewLength) right after the change. Empty for pure deletions.
public ReadOnlyMemory<char> InsertedText { get; set; }
Remarks
The event holds an immutable reference to that text, not a copy; reading this property returns a zero-copy view when the text lies in one storage chunk and copies it on first read otherwise. Later edits do not change it.
Kind Property
Gets the kind of change (Insert, Delete, or Replace).
public Avalonia.Controls.Documents.TextModel.DocumentChangeKind Kind { get; set; }
NewLength Property
Gets the length of text that was inserted (0 for pure deletions).
public int NewLength { get; set; }
Offset Property
Gets the offset where the change occurred.
public int Offset { get; set; }
OldLength Property
Gets the length of text that was deleted (0 for pure insertions).
public int OldLength { get; set; }