DeleteEditSelection
Forms, interaction, edit history
Description
Internal helper of TPDFlibFormSession that implements the Backspace and Delete keys for DispatchInputEvent
With a collapsed selection it first selects one neighboring extended grapheme cluster, the cluster before the caret for Backspace and the cluster after the caret for Delete
At the matching text boundary the helper reports success without deleting anything
The removal itself runs through ApplySelectionEdit as a fekReplaceSelection with an empty replacement, so the /K action and OnTextEdit can still veto it
On success the newest history entry's before positions are rewritten to the selection captured before the deletion so UndoEdit restores it, and on failure the original selection is restored
Declaration
function DeleteEditSelection(Backwards: Boolean): Integer;
Parameters
| Backwards | True deletes toward the text start like Backspace, False deletes toward the end like Delete |
|---|
Return value
Returns 1 when a cluster was selected and removed or the caret already sat at the matching boundary, otherwise 0 when the request was reentrant, no edit is active or the replacement transaction was vetoed
See also
ApplySelectionEdit, DispatchInputEvent, UndoEdit, EnsureSelectionBoundaries, TPDFlibFormInputKey, TPDFlibFormSession