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.
13 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 $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
19 #include <bitstring.h>
24 #include "../common/common.h"
28 * Undo the last change.
30 * PUBLIC: int ex_undo __P((SCR *, EXCMD *));
33 ex_undo(SCR
*sp
, EXCMD
*cmdp
)
40 * Historic undo always set the previous context mark.
44 if (mark_set(sp
, ABSMARK1
, &m
, 1))
49 * Multiple undo isn't available in ex, as there's no '.' command.
50 * Whether 'u' is undo or redo is toggled each time, unless there
51 * was a change since the last undo, in which case it's an undo.
54 if (!F_ISSET(ep
, F_UNDO
)) {
60 if (log_forward(sp
, &m
))
65 if (log_backward(sp
, &m
))