editUndo - WIN

Class editUndo
Inherits from __classBase.

The editUndo class is locally defined in the win API, and is used by the editWindow class to record editing actions for the undo/redo mechanism.

Properties

eu__cache table Recorded editing actions.
eu__index number Current undo/redo index.

Methods

See also API Reference, WIN.

editUndo:can_redo

result editUndo:can_redo ()

Returns if a redo record is available.

Parameters
none


Returns
result boolean True if a redo record is available, false if not.

Remarks
See editUndo:can_undo.


top


editUndo:can_undo

result editUndo:can_undo ()

Returns if an undo record is available.

Parameters
none


Returns
result boolean True if an undo record is available, false if not.

Remarks
See editUndo:can_redo.


top


editUndo:constructor

obj editUndo:constructor ()

Constructor for editUndo object.

Parameters
none


Returns
obj editUndo The instantiated editUndo object.

Remarks


top


editUndo:end_action

editUndo:end_action ()

Ensures the last grouped editing action is closed.

Parameters
none


Returns
none


Remarks


top


editUndo:record

editUndo:record (pos, inserted, removed, action)

Records the editing action, grouping the action when appropriate.

Parameters
pos number The character position where the editing action begins.
inserted table The segment inserted in the edit action as a table of string lines.
removed table The segment removed in the edit action as a table of string lines.
action number The editing action. win.EU_TYPE, win.EU_DELETE and win.EU_BACKSPACE actions are grouped if appropriate.

Returns
none


Remarks
Record cache trimming and action grouping are handled by the call. Valid actions are:
win.EU_REPLACE     = 0
win.EU_TYPE        = 1
win.EU_DELETE      = 2
win.EU_BACKSPACE   = 3


top


editUndo:redo

record editUndo:redo ()

Returns the editing action for the next redo operation if available, updating the current editing record index.

Parameters
none


Returns
record table/nil The editing action data for the redo operation. If none is available nil is returned.

Remarks
If a record is returned the table has the following keys:
pos number The character position where the editing action begins.
inserted table The segment inserted in the edit action as a table of string lines.
removed table The segment removed in the edit action as a table of string lines.
action number Always win.EU_REPLACE.

See editUndo:undo.


top


editUndo:reset

editUndo:reset ()

Removes all editing records.

Parameters
none


Returns
none


Remarks


top


editUndo:undo

record editUndo:undo ()

Returns the editing action for the next undo operation if available, updating the current editing record index.

Parameters
none


Returns
record table/nil The editing action data for the undo operation. If none is available nil is returned.

Remarks
If a record is returned the table has the following keys:
pos number The character position where the editing action begins.
inserted table The segment inserted in the edit action as a table of string lines.
removed table The segment removed in the edit action as a table of string lines.
action number Always win.EU_REPLACE.

See editUndo:redo.


top


See also API Reference, WIN.