diff options
author | Vincent Labrecque <vincent@cvs.openbsd.org> | 2003-11-09 01:11:15 +0000 |
---|---|---|
committer | Vincent Labrecque <vincent@cvs.openbsd.org> | 2003-11-09 01:11:15 +0000 |
commit | 0042c7e702a7aeb711dee3af7d93d923db45d92a (patch) | |
tree | 7b638fffd6135137f537f0b585bd2e547d176925 | |
parent | 56e895f421d41b7e319dd800b023712df1160213 (diff) |
remove the only use of the hackish undo_add_custom function.
-rw-r--r-- | usr.bin/mg/def.h | 3 | ||||
-rw-r--r-- | usr.bin/mg/line.c | 8 | ||||
-rw-r--r-- | usr.bin/mg/undo.c | 35 |
3 files changed, 6 insertions, 40 deletions
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h index b46d321c293..44e0cd6d231 100644 --- a/usr.bin/mg/def.h +++ b/usr.bin/mg/def.h @@ -1,4 +1,4 @@ -/* $OpenBSD: def.h,v 1.51 2003/11/09 00:20:06 vincent Exp $ */ +/* $OpenBSD: def.h,v 1.52 2003/11/09 01:11:14 vincent Exp $ */ #include <sys/queue.h> @@ -586,7 +586,6 @@ int cntnonmatchlines(int, int); void free_undo_record(struct undo_rec *); int undo_dump(int, int); int undo_enable(int); -int undo_add_custom(int, int, LINE *, int, void *, int); int undo_add_boundary(void); int undo_add_insert(LINE *, int, int); int undo_add_delete(LINE *, int, int); diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c index eb7cdddce81..cb656a0a8a2 100644 --- a/usr.bin/mg/line.c +++ b/usr.bin/mg/line.c @@ -1,4 +1,4 @@ -/* $OpenBSD: line.c,v 1.18 2003/04/16 02:38:18 millert Exp $ */ +/* $OpenBSD: line.c,v 1.19 2003/11/09 01:11:14 vincent Exp $ */ /* * Text line handling. @@ -255,9 +255,9 @@ lnewline(void) lchange(WFHARD); - /* XXX */ - undo_add_custom(1,INSERT, curwp->w_dotp, curwp->w_doto, - strdup("\n"), 1); + undo_add_boundary(); + undo_add_insert(curwp->w_dotp, llength(curwp->w_dotp), 1); + undo_add_boundary(); /* Get the address and offset of "." */ lp1 = curwp->w_dotp; diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c index 7768a720205..0594d1fcb99 100644 --- a/usr.bin/mg/undo.c +++ b/usr.bin/mg/undo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undo.c,v 1.19 2003/10/21 22:48:07 vincent Exp $ */ +/* $OpenBSD: undo.c,v 1.20 2003/11/09 01:11:14 vincent Exp $ */ /* * Copyright (c) 2002 Vincent Labrecque * All rights reserved. @@ -203,39 +203,6 @@ undo_add_boundary(void) return (TRUE); } -/* - * If asocial is true, we arrange for this record to be let alone. forever. - * Yes, this is a bit of a hack... - */ -int -undo_add_custom(int asocial, - int type, LINE *lp, int offset, void *content, int size) -{ - struct undo_rec *rec; - - if (undo_disable_flag) - return (TRUE); - rec = new_undo_record(); - if (lp != NULL) - rec->pos = find_absolute_dot(lp, offset); - else - rec->pos = 0; - rec->type = type; - rec->content = content; - rec->region.r_linep = lp; - rec->region.r_offset = offset; - rec->region.r_size = size; - - if (!last_was_boundary()) - undo_add_boundary(); - LIST_INSERT_HEAD(&curwp->w_undo, rec, next); - undo_add_boundary(); - if (asocial) /* Add a second one */ - undo_add_boundary(); - - return (TRUE); -} - int undo_add_insert(LINE *lp, int offset, int size) { |