[BACK]Return to basic.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/basic.c between version 1.47 and 1.48

version 1.47, 2015/10/10 09:13:14 version 1.48, 2019/06/03 16:26:30
Line 21 
Line 21 
   
 #include "def.h"  #include "def.h"
   
   #define percint(n1, n2)         ((n1 * (int) n2) * 0.1)
   
 /*  /*
  * Go to beginning of line.   * Go to beginning of line.
  */   */
Line 115 
Line 117 
 }  }
   
 /*  /*
  * Go to the beginning of the   * Go to the beginning of the buffer. Setting WFFULL is conservative,
  * buffer. Setting WFFULL is conservative,   * but almost always the case. A universal argument of higher than 9
  * but almost always the case.   * puts the cursor back to the end of buffer.
  */   */
 int  int
 gotobob(int f, int n)  gotobob(int f, int n)
Line 127 
Line 129 
         curwp->w_doto = 0;          curwp->w_doto = 0;
         curwp->w_rflag |= WFFULL;          curwp->w_rflag |= WFFULL;
         curwp->w_dotline = 1;          curwp->w_dotline = 1;
           if (f & FFOTHARG && n > 0) {
                   if (n > 9)
                           gotoeob(0, 0);
                   else
                           forwline(f, percint(curwp->w_bufp->b_lines, n) - 1);
           }
         return (TRUE);          return (TRUE);
 }  }
   
 /*  /*
  * Go to the end of the buffer. Leave dot 3 lines from the bottom of the   * Go to the end of the buffer. Leave dot 3 lines from the bottom of the
  * window if buffer length is longer than window length; same as emacs.   * window if buffer length is longer than window length; same as emacs.
  * Setting WFFULL is conservative, but almost always the case.   * Setting WFFULL is conservative, but almost always the case. A universal
    * argument of higher than 9 puts the cursor back to the start of buffer.
  */   */
 int  int
 gotoeob(int f, int n)  gotoeob(int f, int n)
 {  {
           int              ln;
         struct line     *lp;          struct line     *lp;
   
         (void) setmark(f, n);          (void) setmark(f, n);
Line 146 
Line 156 
         curwp->w_dotline = curwp->w_bufp->b_lines;          curwp->w_dotline = curwp->w_bufp->b_lines;
   
         lp = curwp->w_dotp;          lp = curwp->w_dotp;
         n = curwp->w_ntrows - 3;          ln = curwp->w_ntrows - 3;
   
         if (n < curwp->w_bufp->b_lines && n >= 3) {          if (ln < curwp->w_bufp->b_lines && ln >= 3) {
                 while (n--)                  while (ln--)
                         curwp->w_dotp = lback(curwp->w_dotp);                          curwp->w_dotp = lback(curwp->w_dotp);
   
                 curwp->w_linep = curwp->w_dotp;                  curwp->w_linep = curwp->w_dotp;
                 curwp->w_dotp = lp;                  curwp->w_dotp = lp;
         }          }
           if (f & FFOTHARG && n > 0) {
                   if (n > 9)
                           gotobob(0, 0);
                   else
                           backline(f, percint(curwp->w_bufp->b_lines, n));
           }
   
         curwp->w_rflag |= WFFULL;          curwp->w_rflag |= WFFULL;
         return (TRUE);          return (TRUE);
 }  }

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48