public enum CaretAffinityWhich of the two characters either side of an index a caret belongs to.
Remarks
An index names a boundary between two characters, and a boundary is not a place. Where both neighbours run the same way it may as well be — the character before ends exactly where the character after begins, so the two readings are the same point and nothing can tell them apart. At a direction boundary they are at opposite ends of a run, and often at opposite ends of the line.
⚠ This is what makes CaretOffset and CaretPositionAt inverses of each other. Without it the first is a function from one index to two places and has to pick one, so hit-testing a caret's own offset can return a caret drawn somewhere else — which on screen is a caret that teleports across the line when the user clicks exactly where it already is.
⚠ It does not make the relation a bijection, and no bit could. Two different indices can share one point: in abcلسان the caret after the c and the caret at the end of the text are both at the left edge of the Arabic run. That direction of the ambiguity is irreducible — a point genuinely names two positions — and is resolved by an editor remembering where its caret was, never by asking the text.
Fields and properties (2)
DownstreamThe character after the index — the caret sits at that character's leading edge. The reading a caret arriving from the left, or from a click on the character itself, has.
UpstreamThe character before the index — the caret sits at that character's trailing edge. The reading a caret that has just typed, or walked forward off the end of a run, has.
Used by (11)
- BidiMirroringTestsVixen.Ui.Tests
- CaretAffinityTestsVixen.Ui.Controls.Tests
- CaretAffinityTestsVixen.Ui.Tests
- CaretTestsVixen.Ui.Text.Tests
- ShapedTextVixen.Ui.Text
- TextFieldVixen.Ui.Controls
- TextFieldTestsVixen.Ui.Controls.Tests
- TextLayoutVixen.Ui
- TextLineVixen.Ui
- TextRunVixen.Ui
- TextWrapTestsVixen.Ui.Tests