Skip to main content

TextChangeEventArgs Class

Definition​

Assembly:Avalonia.Controls.Documents
Package:Avalonia.Controls.Documents

Raised after a single text change is applied (via Avalonia.Controls.Documents.TextModel.TextDocument.TextChanged event). Multiple text changes may fire within one Avalonia.Controls.Documents.TextModel.TextDocument.BeginChange scope; consumers that want a per-commit view should subscribe to Avalonia.Controls.Documents.TextModel.TextDocument.Changed instead.

public class TextChangeEventArgs

Inheritance: EventArgs -> TextChangeEventArgs

Properties​

NameDescription
InsertedTextGets the inserted text as a zero-copy view into the rope. Empty for pure deletions. May be shorter than Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.NewLength when the inserted range crosses a rope-leaf boundary; callers that need the full string should call ReadOnlyMemory<T>.ToString or read from Avalonia.Controls.Documents.TextModel.TextDocument directly.
KindGets the kind of change (Insert, Delete, or Replace).
NewLengthGets the length of text that was inserted (0 for pure deletions).
OffsetGets the offset where the change occurred.
OldLengthGets the length of text that was deleted (0 for pure insertions).

InsertedText Property​

Gets the inserted text as a zero-copy view into the rope. Empty for pure deletions. May be shorter than Avalonia.Controls.Documents.TextModel.TextChangeEventArgs.NewLength when the inserted range crosses a rope-leaf boundary; callers that need the full string should call ReadOnlyMemory<T>.ToString or read from Avalonia.Controls.Documents.TextModel.TextDocument directly.

public ReadOnlyMemory<char> InsertedText { get; set; }

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; }