summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlum <lum@openbsd.org>2014-10-13 21:01:05 +0000
committerlum <lum@openbsd.org>2014-10-13 21:01:05 +0000
commit0d05d31641bc5569516e1e174e663e435a34e41b (patch)
tree288a77a6e95b50bc67a1accbb7e236bf671683e2
parentremove unused variable (diff)
downloadwireguard-openbsd-0d05d31641bc5569516e1e174e663e435a34e41b.tar.xz
wireguard-openbsd-0d05d31641bc5569516e1e174e663e435a34e41b.zip
gotoeop() does not behave as expected when there is no '\n' at the end of the
buffer. ok florian@
-rw-r--r--usr.bin/mg/paragraph.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c
index a80f572394c..00920d0dff0 100644
--- a/usr.bin/mg/paragraph.c
+++ b/usr.bin/mg/paragraph.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: paragraph.c,v 1.32 2014/10/12 18:09:41 lum Exp $ */
+/* $OpenBSD: paragraph.c,v 1.33 2014/10/13 21:01:05 lum Exp $ */
/* This file is in the public domain. */
@@ -92,6 +92,10 @@ gotoeop(int f, int n)
curwp->w_dotline++;
}
}
+ /* covers corner case of no '\n' at end of buffer */
+ if (lforw(curwp->w_dotp) == curbp->b_headp)
+ gotoeol(FFRAND, 1);
+
/* force screen update */
curwp->w_rflag |= WFMOVE;
return (TRUE);