ApplyEditHistory

Forms, interaction, edit history

Description

Internal helper of TPDFlibFormSession that replays exactly one retained history entry and backs UndoEdit and RedoEdit

Undoing verifies that the entry's inserted text is still present at its start index, splices the removed text back and restores the anchor and caret captured before the change; redoing verifies the removed text, splices the inserted text and restores the positions captured after the change

When the verification or the restored selection bounds fail, the call returns 0 without touching any state

The replay updates the transient value, display value and directed selection, rebuilds the cached Unicode boundary tables, recomputes Modified and moves the history position

The whole operation runs behind an applying-history guard, so no form actions and no host edit callbacks are redispatched

Declaration

function ApplyEditHistory(Undoing: Boolean): Integer;

Parameters

UndoingTrue reverses the entry below the current history position, False replays the entry above it

Return value

Returns 1 when the entry was replayed, otherwise 0 because the call was reentrant, no edit is active, no entry is available in the requested direction or verification failed

See also

UndoEdit, RedoEdit, CanUndoEdit, CanRedoEdit, AddEditHistory, ClearEditHistory, EditValue, TPDFlibFormSession