summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2006-11-18 20:36:51 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2006-11-18 20:36:51 +0000
commitf5908d679ed306c24fdaf83ba0993770f3066d8e (patch)
tree93e5f25ce9c142c0a1787032f79dcec7110d4840
parent43a738472054bef89d74c3aea7de29a1889a3ca7 (diff)
Due to a thinko on my part, (and a badly named structure member),
line numbers were horribly broken with pgup, pgdn. From peter de wachter, via debian bug#391827
-rw-r--r--usr.bin/mg/basic.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c
index 4a6d0782e05..22c874e93d8 100644
--- a/usr.bin/mg/basic.c
+++ b/usr.bin/mg/basic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: basic.c,v 1.26 2006/07/25 08:27:09 kjell Exp $ */
+/* $OpenBSD: basic.c,v 1.27 2006/11/18 20:36:50 kjell Exp $ */
/* This file is in the public domain */
@@ -273,7 +273,6 @@ forwpage(int f, int n)
lp = curwp->w_linep;
while (n-- && lforw(lp) != curbp->b_headp) {
lp = lforw(lp);
- curwp->w_dotline++;
}
curwp->w_linep = lp;
curwp->w_flag |= WFFULL;
@@ -281,7 +280,11 @@ forwpage(int f, int n)
for (n = curwp->w_ntrows; n-- && lp != curbp->b_headp; lp = lforw(lp))
if (lp == curwp->w_dotp)
return (TRUE);
- curwp->w_dotp = curwp->w_linep;
+ /* Advance the dot the slow way, for line nos */
+ while (curwp->w_dotp != curwp->w_linep) {
+ curwp->w_dotp = lforw(curwp->w_dotp);
+ curwp->w_dotline++;
+ }
curwp->w_doto = 0;
return (TRUE);
}
@@ -313,7 +316,6 @@ backpage(int f, int n)
lp = curwp->w_linep;
while (n-- && lback(lp) != curbp->b_headp) {
lp = lback(lp);
- curwp->w_dotline--;
}
curwp->w_linep = lp;
curwp->w_flag |= WFFULL;
@@ -321,7 +323,11 @@ backpage(int f, int n)
for (n = curwp->w_ntrows; n-- && lp != curbp->b_headp; lp = lforw(lp))
if (lp == curwp->w_dotp)
return (TRUE);
- curwp->w_dotp = curwp->w_linep;
+ /* Move the dot the slow way, for line nos */
+ while (curwp->w_dotp != curwp->w_linep) {
+ curwp->w_dotp = lback(curwp->w_dotp);
+ curwp->w_dotline--;
+ }
curwp->w_doto = 0;
return (TRUE);
}