Lugaru's Epsilon
Editor 14.01

Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         . . .
         Undo Primitives
         Searching Primitives
         Moving by Lines
         . . .
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
      . . .

Previous   Up    Next
Narrowing  Primitives and EEL Subroutines   Searching Primitives

Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Buffer Primitives >

Undo Primitives

int undo_op(int is_undo)
user buffer int undo_size;

With a nonzero argument, the undo_op( ) primitive undoes one basic operation like the undo command, described in Undoing. With an argument of zero, it acts like redo. It returns a bit pattern describing what types of operations were undone or redone. The bit codes are defined in codes.h. UNDO_INSERT means that originally an insertion occurred, and it was either undone or redone. The UNDO_DELETE and UNDO_REPLACE codes are similar.

Epsilon groups individual buffer changes into groups, and undoes one group at a time. While saving changes for undoing, Epsilon begins a new group when it redisplays buffers or when it begins a new command in the main loop. The UNDO_REDISP code indicates the former happened, and UNDO_MAINLOOP the latter. UNDO_MOVE indicates movement is being undone, and UNDO_END is used when Epsilon could only undo part of a command. If undo_op( ) returns zero, the buffer was not collecting undo information (see below).

Epsilon automatically starts a new undo group each time it does normal redisplay or passes through its main loop, by calling either the undo_redisplay( ) or undo_mainloop( ) primitives, respectively. You can call either of these primitives yourself to make Epsilon start a new undo group.

In addition to starting a new group, the undo_mainloop( ) primitive also makes the current buffer start to collect undo information. When you first create a buffer, Epsilon doesn't keep undo information for it, so that "system" buffers don't have this unnecessary overhead. Each time it passes through the main loop, Epsilon calls undo_mainloop( ), and this makes the current buffer start collecting undo information, if it isn't already, and if the buffer-specific variable undo_size is nonzero.

int undo_count(int is_undo)

The undo_count( ) primitive takes a parameter that specifies whether undoing or redoing is involved, like undo_op( ). The primitive returns a value indicating how much undoing or redoing information is saved. The number doesn't correspond to a particular number of commands, but to their complexity.

user buffer int undo_flag;

In addition to buffer changes and movements, Epsilon can record other information in its list of undoable operations. Each time you set the undo_flag variable, Epsilon inserts a "flag" in its undo list with the particular value you specify. When Epsilon is undoing or redoing and encounters a flag, it immediately ends the current group of undo operations and returns a code with the UNDO_FLAG bit on. It puts the value of the flag it encountered in the undo_flag variable. The yank-pop command uses flags 1 and 2 for undoing the previous yank.

Previous   Up    Next
Narrowing  Primitives and EEL Subroutines   Searching Primitives

Lugaru Epsilon Programmer's Editor 14.01 manual. Copyright (C) 1984, 2020 by Lugaru Software Ltd. All rights reserved.