4 * Copyright (c) 1992, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1992, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved.
9 * See the LICENSE file for redistribution information.
15 static const char sccsid
[] = "Id: ex_undo.c,v 10.7 2001/06/25 15:19:21 skimo Exp (Berkeley) Date: 2001/06/25 15:19:21";
18 #include <sys/types.h>
19 #include <sys/queue.h>
21 #include <bitstring.h>
26 #include "../common/common.h"
30 * Undo the last change.
32 * PUBLIC: int ex_undo __P((SCR *, EXCMD *));
35 ex_undo(SCR
*sp
, EXCMD
*cmdp
)
42 * Historic undo always set the previous context mark.
46 if (mark_set(sp
, ABSMARK1
, &m
, 1))
51 * Multiple undo isn't available in ex, as there's no '.' command.
52 * Whether 'u' is undo or redo is toggled each time, unless there
53 * was a change since the last undo, in which case it's an undo.
56 if (!F_ISSET(ep
, F_UNDO
)) {
62 if (log_forward(sp
, &m
))
67 if (log_backward(sp
, &m
))