2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
12 #include <sys/types.h>
13 #include <sys/queue.h>
16 #include <bitstring.h>
21 #include "../common/common.h"
25 * Undo the last change.
27 * PUBLIC: int ex_undo(SCR *, EXCMD *);
30 ex_undo(SCR *sp, EXCMD *cmdp)
37 * Historic undo always set the previous context mark.
41 if (mark_set(sp, ABSMARK1, &m, 1))
46 * Multiple undo isn't available in ex, as there's no '.' command.
47 * Whether 'u' is undo or redo is toggled each time, unless there
48 * was a change since the last undo, in which case it's an undo.
51 if (!F_ISSET(ep, F_UNDO)) {
57 if (log_forward(sp, &m))
62 if (log_backward(sp, &m))