> There is a corner case when the screen buffer is only 1 line long
> where the loop that looks for the current dot line goes through the
> whole buffer until it finds the correct line. This means the line
> number decrement is way over what it should be. This diff accounts
> for that corner case. ok?
>
This version uses the existing function backline() that already moves
the cursor and linep by one line. This keeps the backpage() function
for paging backwards.
-lum
Index: basic.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/basic.c,v
retrieving revision 1.34
diff -u -p -r1.34 basic.c
--- basic.c 1 Jun 2012 11:22:06 -0000 1.34
+++ basic.c 7 Jun 2012 15:25:34 -0000
@@ -309,7 +309,7 @@ backpage(int f, int n)
if (!(f & FFARG)) {
n = curwp->w_ntrows - 2; /* Default scroll. */
if (n <= 0) /* Don't blow up if the */
- n = 1; /* window is tiny. */
+ return(backline(f, 1)); /* window is tiny. */
} else if (n < 0)
return (forwpage(f | FFRAND, -n));