NormalizeSelection

Forms, interaction, unicode

Description

Recomputes the normalised SelectionStart and SelectionLength pair from the directed SelectionAnchor and SelectionCaret positions

When the anchor is at or before the caret the start becomes the anchor, otherwise the start becomes the caret, and the length is the absolute distance between both edges in either case

The session runs this normalisation before every operation that reads the selection, including selection edits, undo, redo and visual caret movement, so the normalised pair never goes stale

Declaration

procedure NormalizeSelection;

See also

SelectionStart, SelectionLength, SelectionAnchor, SelectionCaret, GetSelectionRange