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

ApplyEditHistory 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 editRemovedText replays an entry in either direction: undo re-inserts StartIndex at Before* and restores the InsertedText selection, redo re-applies After* and the

TrimEditHistory selectionEntries live in the session-internal history list, which MaxUndoSteps keeps inside the UndoEditCount budget by dropping the oldest and the already-undone entries; RedoEditCount and

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