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

Diff for /src/usr.bin/mg/buffer.c between version 1.61 and 1.62

version 1.61, 2006/07/08 17:50:30 version 1.62, 2006/07/25 08:22:32
Line 162 
Line 162 
         }          }
         if (bp == curbp)          if (bp == curbp)
                 curbp = bp1;                  curbp = bp1;
         free(bp->b_linep);                      /* Release header line.  */          free(bp->b_headp);                      /* Release header line.  */
         bp2 = NULL;                             /* Find the header.      */          bp2 = NULL;                             /* Find the header.      */
         bp1 = bheadp;          bp1 = bheadp;
         while (bp1 != bp) {          while (bp1 != bp) {
Line 299 
Line 299 
   
                 nbytes = 0;                     /* Count bytes in buf.   */                  nbytes = 0;                     /* Count bytes in buf.   */
                 if (bp != blp) {                  if (bp != blp) {
                         lp = lforw(bp->b_linep);                          lp = lforw(bp->b_headp);
                         while (lp != bp->b_linep) {                          while (lp != bp->b_headp) {
                                 nbytes += llength(lp) + 1;                                  nbytes += llength(lp) + 1;
                                 lp = lforw(lp);                                  lp = lforw(lp);
                         }                          }
Line 321 
Line 321 
                     bp->b_fname) == FALSE)                      bp->b_fname) == FALSE)
                         return (NULL);                          return (NULL);
         }          }
         blp->b_dotp = lforw(blp->b_linep);      /* put dot at beginning of          blp->b_dotp = lforw(blp->b_headp);      /* put dot at beginning of
                                                  * buffer */                                                   * buffer */
         blp->b_doto = 0;          blp->b_doto = 0;
         return (blp);                           /* All done              */          return (blp);                           /* All done              */
Line 410 
Line 410 
         lp->l_used = strlen(lp->l_text);          lp->l_used = strlen(lp->l_text);
         va_end(ap);          va_end(ap);
   
         bp->b_linep->l_bp->l_fp = lp;           /* Hook onto the end     */          bp->b_headp->l_bp->l_fp = lp;           /* Hook onto the end     */
         lp->l_bp = bp->b_linep->l_bp;          lp->l_bp = bp->b_headp->l_bp;
         bp->b_linep->l_bp = lp;          bp->b_headp->l_bp = lp;
         lp->l_fp = bp->b_linep;          lp->l_fp = bp->b_headp;
         bp->b_lines++;          bp->b_lines++;
   
         return (TRUE);          return (TRUE);
Line 515 
Line 515 
         bp->b_marko = 0;          bp->b_marko = 0;
         bp->b_flag = defb_flag;          bp->b_flag = defb_flag;
         bp->b_nwnd = 0;          bp->b_nwnd = 0;
         bp->b_linep = lp;          bp->b_headp = lp;
         bp->b_nmodes = defb_nmodes;          bp->b_nmodes = defb_nmodes;
         LIST_INIT(&bp->b_undo);          LIST_INIT(&bp->b_undo);
         bp->b_undoptr = NULL;          bp->b_undoptr = NULL;
Line 557 
Line 557 
             (s = eyesno("Buffer modified; kill anyway")) != TRUE)              (s = eyesno("Buffer modified; kill anyway")) != TRUE)
                 return (s);                  return (s);
         bp->b_flag &= ~BFCHG;   /* Not changed           */          bp->b_flag &= ~BFCHG;   /* Not changed           */
         while ((lp = lforw(bp->b_linep)) != bp->b_linep)          while ((lp = lforw(bp->b_headp)) != bp->b_headp)
                 lfree(lp);                  lfree(lp);
         bp->b_dotp = bp->b_linep;       /* Fix dot */          bp->b_dotp = bp->b_headp;       /* Fix dot */
         bp->b_doto = 0;          bp->b_doto = 0;
         bp->b_markp = NULL;     /* Invalidate "mark"     */          bp->b_markp = NULL;     /* Invalidate "mark"     */
         bp->b_marko = 0;          bp->b_marko = 0;
Line 700 
Line 700 
         }          }
         /* insert the buffer */          /* insert the buffer */
         nline = 0;          nline = 0;
         clp = lforw(bp->b_linep);          clp = lforw(bp->b_headp);
         for (;;) {          for (;;) {
                 for (clo = 0; clo < llength(clp); clo++)                  for (clo = 0; clo < llength(clp); clo++)
                         if (linsert(1, lgetc(clp, clo)) == FALSE)                          if (linsert(1, lgetc(clp, clo)) == FALSE)
                                 return (FALSE);                                  return (FALSE);
                 if ((clp = lforw(clp)) == bp->b_linep)                  if ((clp = lforw(clp)) == bp->b_headp)
                         break;                          break;
                 if (newline(FFRAND, 1) == FALSE)        /* fake newline */                  if (newline(FFRAND, 1) == FALSE)        /* fake newline */
                         return (FALSE);                          return (FALSE);
Line 718 
Line 718 
   
         clp = curwp->w_linep;           /* cosmetic adjustment  */          clp = curwp->w_linep;           /* cosmetic adjustment  */
         if (curwp->w_dotp == clp) {     /* for offscreen insert */          if (curwp->w_dotp == clp) {     /* for offscreen insert */
                 while (nline-- && lback(clp) != curbp->b_linep)                  while (nline-- && lback(clp) != curbp->b_headp)
                         clp = lback(clp);                          clp = lback(clp);
                 curwp->w_linep = clp;   /* adjust framing.      */                  curwp->w_linep = clp;   /* adjust framing.      */
                 curwp->w_flag |= WFFULL;                  curwp->w_flag |= WFFULL;
Line 756 
Line 756 
 {  {
         struct mgwin *wp;          struct mgwin *wp;
   
         bp->b_dotp = lforw(bp->b_linep);          bp->b_dotp = lforw(bp->b_headp);
         bp->b_doto = 0;          bp->b_doto = 0;
         if (bp->b_nwnd != 0) {          if (bp->b_nwnd != 0) {
                 for (wp = wheadp; wp != NULL; wp = wp->w_wndp)                  for (wp = wheadp; wp != NULL; wp = wp->w_wndp)

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62