TPDFlibFormEditHistoryEntry

Data types, forms, interaction, edit history

Description

Class that captures one undoable text edit made while a form session edits a text field

RecordEditHistory compares the previous and the new edit value, reduces them to their common prefix and suffix, and stores one entry that describes exactly the replaced slice together with the selection anchor and caret before and after the edit

ApplyEditHistory replays an entry in either direction: undo re-inserts RemovedText at StartIndex and restores the Before* selection, redo re-applies InsertedText and the After* selection

Entries live in the session-internal history list, which TrimEditHistory keeps inside the MaxUndoSteps budget by dropping the oldest and the already-undone entries; UndoEditCount and RedoEditCount report the current position within that list

Declaration

TPDFlibFormEditHistoryEntry = class public StartIndex: Integer; RemovedText: WideString; InsertedText: WideString; BeforeAnchor: Integer; BeforeCaret: Integer; AfterAnchor: Integer; AfterCaret: Integer; end;

Fields

StartIndexNumber of leading characters the old and the new value share; the replaced slice begins immediately after them
RemovedTextSlice that the edit deleted from the previous edit value
InsertedTextSlice that the edit wrote in its place
BeforeAnchorSelection anchor recorded before the edit, in the session selection units
BeforeCaretSelection caret recorded before the edit, in the session selection units
AfterAnchorSelection anchor recorded after the edit, in the session selection units
AfterCaretSelection caret recorded after the edit, in the session selection units

See also

TPDFlibFormSession, UndoEdit, RedoEdit, CanUndoEdit, ClearEditHistory, UndoEditCount, RedoEditCount, MaxUndoSteps