diff options
author | 2002-02-21 03:24:14 +0000 | |
---|---|---|
committer | 2002-02-21 03:24:14 +0000 | |
commit | 43f5f2a25dd4f08ef83aca39dab15f7cfd1449d6 (patch) | |
tree | 54906df32fbff7ed1829d6802bc66aa1525a114f | |
parent | Fix /tmp races. (diff) | |
download | wireguard-openbsd-43f5f2a25dd4f08ef83aca39dab15f7cfd1449d6.tar.xz wireguard-openbsd-43f5f2a25dd4f08ef83aca39dab15f7cfd1449d6.zip |
Typo and...
Duh, newlines aren't even stored in the lines' content, check for
a 0 length line to detect deleting newlines.
-rw-r--r-- | usr.bin/mg/undo.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c index d059211b7e9..6e8b5d2f532 100644 --- a/usr.bin/mg/undo.c +++ b/usr.bin/mg/undo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undo.c,v 1.2 2002/02/20 23:15:03 vincent Exp $ */ +/* $OpenBSD: undo.c,v 1.3 2002/02/21 03:24:14 vincent Exp $ */ /* * Copyright (c) 2002 Vincent Labrecque <vincent@openbsd.org> * All rights reserved. @@ -70,7 +70,7 @@ find_offset(LINE *lp, int off) for (p = curwp->w_linep; p != lp; p = lforw(p)) { if (count != 0) { - if (p == curbp->b_linep) { + if (p == curwp->w_linep) { ewprintf("Error: Undo stuff called with a" "nonexistent line\n"); return FALSE; @@ -265,9 +265,10 @@ undo_add_delete(LINE *lp, int offset, int size) reg.r_size = size; pos = find_offset(lp, offset); - - if (size == 1 && lgetc(lp, offset) == '\n') + + if (size == 1 && llength(lp) == 0) { skip = 1; + } /* * Again, try to reuse last undo record, if we can |