1 /* $NetBSD: ex_undo.c,v 1.2 2013/11/22 15:52:05 christos Exp $ */
3 * Copyright (c) 1992, 1993, 1994
4 * The Regents of the University of California. All rights reserved.
5 * Copyright (c) 1992, 1993, 1994, 1995, 1996
6 * Keith Bostic. All rights reserved.
8 * See the LICENSE file for redistribution information.
14 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 ";
17 #include <sys/types.h>
18 #include <sys/queue.h>
20 #include <bitstring.h>
25 #include "../common/common.h"
29 * Undo the last change.
31 * PUBLIC: int ex_undo __P((SCR *, EXCMD *));
34 ex_undo(SCR
*sp
, EXCMD
*cmdp
)
41 * Historic undo always set the previous context mark.
45 if (mark_set(sp
, ABSMARK1
, &m
, 1))
50 * Multiple undo isn't available in ex, as there's no '.' command.
51 * Whether 'u' is undo or redo is toggled each time, unless there
52 * was a change since the last undo, in which case it's an undo.
55 if (!F_ISSET(ep
, F_UNDO
)) {
61 if (log_forward(sp
, &m
))
66 if (log_backward(sp
, &m
))