EnsureVisualCaretOrder
Forms, interaction, unicode
Description
Internal helper of TPDFlibFormSession that computes the cached physical caret slot order used by visual caret movement
A valid cache for the current edit value and resolved text direction is reused, otherwise the order is rebuilt from the grapheme boundary table
The value is split into lines at LF, CR and CRLF breaks, and each line is resolved into bidirectional runs under the resolved base direction, with a single-run fallback when run resolution fails
Run embedding levels are clamped to the range 0 through 125 and the visual run order follows the resolved levels
Grapheme boundary indexes are appended in physical left-to-right order across the runs, forward for left-to-right runs and backward for right-to-left runs, so a logical index at a mixed-direction boundary can occupy two distinct slots
Consecutive duplicate slots are merged, line-break positions become their own slots, an empty result falls back to the single slot 0 and a rebuild resets the visual slot position to -1
Declaration
procedure EnsureVisualCaretOrder;
See also
InvalidateVisualCaretOrder, GetVisualCaretOrder, MoveVisualCaret, GetResolvedTextDirection, EnsureSelectionBoundaries, TPDFlibFormTextDirection, TPDFlibFormSession