Fix forward-paragraph and backward-paragraph's handling of line
numbers. 

ok?

-lum

Index: paragraph.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/paragraph.c,v
retrieving revision 1.22
diff -u -p -r1.22 paragraph.c
--- paragraph.c 29 Nov 2011 05:59:54 -0000      1.22
+++ paragraph.c 14 Feb 2013 20:35:18 -0000
@@ -41,9 +41,10 @@ gotobop(int f, int n)
                        if (llength(lback(curwp->w_dotp)) &&
                            lgetc(curwp->w_dotp, 0) != ' ' &&
                            lgetc(curwp->w_dotp, 0) != '.' &&
-                           lgetc(curwp->w_dotp, 0) != '\t')
+                           lgetc(curwp->w_dotp, 0) != '\t') {
                                curwp->w_dotp = lback(curwp->w_dotp);
-                       else {
+                               curwp->w_dotline--;
+                       } else {
                                if (llength(lback(curwp->w_dotp)) &&
                                    lgetc(curwp->w_dotp, 0) == '.') {
                                        curwp->w_dotp = lforw(curwp->w_dotp);
@@ -56,6 +57,7 @@ gotobop(int f, int n)
                                                    lback(curwp->w_dotp);
                                                curwp->w_doto =
                                                    llength(curwp->w_dotp);
+                                               curwp->w_dotline--;
                                        }
                                }
                                break;
@@ -93,9 +95,10 @@ gotoeop(int f, int n)
                        if (llength(curwp->w_dotp) &&
                            lgetc(curwp->w_dotp, 0) != ' ' &&
                            lgetc(curwp->w_dotp, 0) != '.' &&
-                           lgetc(curwp->w_dotp, 0) != '\t')
+                           lgetc(curwp->w_dotp, 0) != '\t') {
                                curwp->w_dotp = lforw(curwp->w_dotp);
-                       else
+                               curwp->w_dotline++;
+                       } else
                                break;
                }
                if (curwp->w_dotp == curbp->b_headp) {
@@ -103,7 +106,8 @@ gotoeop(int f, int n)
                        curwp->w_dotp = lback(curwp->w_dotp);
                        curwp->w_doto = llength(curwp->w_dotp);
                        break;
-               }
+               } else
+                       curwp->w_dotline++;
        }
        /* force screen update */
        curwp->w_rflag |= WFMOVE;

Reply via email to