StaticTextPointer Struct
Definition
A lightweight value type representing a document position as an offset with logical direction (gravity). Use this instead of Avalonia.Controls.Documents.TextModel.TextPointer on hot paths where only offset and direction are needed (rendering, hit-testing, line queries).
public struct StaticTextPointer
Remarks
StaticTextPointer is 8 bytes (int + enum), stack-allocated, and
requires zero heap allocations. It is the value-type counterpart
to the full Avalonia.Controls.Documents.TextModel.TextPointer class, following the same
dual pattern as WPF's StaticTextPointer / TextPointer.
This type intentionally does not carry a node reference. To obtain a
node-aware Avalonia.Controls.Documents.TextModel.TextPointer, use the containing element's
ContentStart / ContentEnd properties on
ITextLine.ContainingElement instead of converting
from offset alone, which cannot disambiguate between consecutive
zero-length blocks that share the same offset.
Constructors
| Name | Description |
|---|---|
| StaticTextPointer | A lightweight value type representing a document position as an offset with logical direction (gravity). Use this instead of Avalonia.Controls.Documents.TextModel.TextPointer on hot paths where only offset and direction are needed (rendering, hit-testing, line queries). |
StaticTextPointer Constructor
A lightweight value type representing a document position as an offset with logical direction (gravity). Use this instead of Avalonia.Controls.Documents.TextModel.TextPointer on hot paths where only offset and direction are needed (rendering, hit-testing, line queries).
public StaticTextPointer(int Offset, Avalonia.Controls.Documents.TextModel.LogicalDirection Direction)
Parameters
Offset int
Direction Avalonia.Controls.Documents.TextModel.LogicalDirection
Remarks
StaticTextPointer is 8 bytes (int + enum), stack-allocated, and
requires zero heap allocations. It is the value-type counterpart
to the full Avalonia.Controls.Documents.TextModel.TextPointer class, following the same
dual pattern as WPF's StaticTextPointer / TextPointer.
This type intentionally does not carry a node reference. To obtain a
node-aware Avalonia.Controls.Documents.TextModel.TextPointer, use the containing element's
ContentStart / ContentEnd properties on
ITextLine.ContainingElement instead of converting
from offset alone, which cannot disambiguate between consecutive
zero-length blocks that share the same offset.
Methods
| Name | Description |
|---|---|
| CompareTo | Compares two positions by offset. |
| Deconstruct | No summary available. |
| Equals (2 overloads) | No summary available. |
| GetHashCode | No summary available. |
| ToString | No summary available. |
CompareTo Method
Compares two positions by offset.
public int CompareTo(Avalonia.Controls.Documents.TextModel.StaticTextPointer other)
Parameters
other Avalonia.Controls.Documents.TextModel.StaticTextPointer
Returns
int
Deconstruct Method
public void Deconstruct(int& Offset, Avalonia.Controls.Documents.TextModel.LogicalDirection& Direction)
Parameters
Offset int&
Direction Avalonia.Controls.Documents.TextModel.LogicalDirection&
Equals overloads
Equals Method
public bool Equals(Avalonia.Controls.Documents.TextModel.StaticTextPointer other)
Parameters
other Avalonia.Controls.Documents.TextModel.StaticTextPointer
Returns
bool
Equals Method
public bool Equals(object obj)
Parameters
obj object
Returns
bool
GetHashCode Method
public int GetHashCode()
Returns
int
ToString Method
public string ToString()
Returns
string
Properties
Direction Property
public Avalonia.Controls.Documents.TextModel.LogicalDirection Direction { get; set; }
Offset Property
public int Offset { get; set; }