summaryrefslogtreecommitdiff
path: root/usr.bin/mg/undo.c
diff options
context:
space:
mode:
authorVincent Labrecque <vincent@cvs.openbsd.org>2002-02-21 04:21:06 +0000
committerVincent Labrecque <vincent@cvs.openbsd.org>2002-02-21 04:21:06 +0000
commit366edcbbc557ff4038e8308cbe066b3fbe320610 (patch)
tree7cf03d42329057fdd2ad12e6bf74876053bf511b /usr.bin/mg/undo.c
parentfe4c5b87b5ae9ee2fd922a008c834af5f671fc45 (diff)
Save undo records for newline insertions.
That makes mg behave more like GNU emacs.
Diffstat (limited to 'usr.bin/mg/undo.c')
-rw-r--r--usr.bin/mg/undo.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c
index 1866d7432d5..2dbe5a5dbc3 100644
--- a/usr.bin/mg/undo.c
+++ b/usr.bin/mg/undo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: undo.c,v 1.4 2002/02/21 04:16:27 vincent Exp $ */
+/* $OpenBSD: undo.c,v 1.5 2002/02/21 04:21:05 vincent Exp $ */
/*
* Copyright (c) 2002 Vincent Labrecque <vincent@openbsd.org>
* All rights reserved.
@@ -187,6 +187,27 @@ undo_enable(int on)
}
int
+undo_add_custom(int type, LINE *lp, int offset, void *content, int size)
+{
+ struct undo_rec *rec;
+
+ if (undo_disable_flag)
+ return TRUE;
+ rec = new_undo_record();
+ rec->pos = find_offset(lp, offset);
+ rec->buf = curbp;
+ rec->type = type;
+ rec->content = content;
+ rec->region.r_linep = lp;
+ rec->region.r_offset = offset;
+ rec->region.r_size = size;
+
+ LIST_INSERT_HEAD(&undo_list, rec, next);
+
+ return TRUE;
+}
+
+int
undo_add_boundary(void)
{
struct undo_rec *rec;