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

Diff for /src/usr.bin/mg/undo.c between version 1.23 and 1.24

version 1.23, 2003/11/29 17:28:40 version 1.24, 2003/12/15 00:00:12
Line 51 
Line 51 
 /*  /*
  * Local functions   * Local functions
  */   */
 static int find_absolute_dot(LINE *, int);  static int find_dot(LINE *, int);
 static int find_line_offset(int, LINE **, int *);  static int find_lo(int, LINE **, int *);
 static struct undo_rec *new_undo_record(void);  static struct undo_rec *new_undo_record(void);
 static int drop_oldest_undo_record(void);  static int drop_oldest_undo_record(void);
   
 /*  /*
  * find_{absolute_dot,line_offset}()   * find_dot, find_lo()
  *   *
  * Find an absolute dot in the buffer from a line/offset pair, and vice-versa.   * Find an absolute dot in the buffer from a line/offset pair, and vice-versa.
  *   *
Line 66 
Line 66 
  */   */
   
 static int  static int
 find_absolute_dot(LINE *lp, int off)  find_dot(LINE *lp, int off)
 {  {
         int count = 0;          int count = 0;
         LINE *p;          LINE *p;
Line 87 
Line 87 
 }  }
   
 static int  static int
 find_line_offset(int pos, LINE **olp, int *offset)  find_lo(int pos, LINE **olp, int *offset)
 {  {
         LINE *p;          LINE *p;
   
Line 216 
Line 216 
         reg.r_offset = offset;          reg.r_offset = offset;
         reg.r_size = size;          reg.r_size = size;
   
         pos = find_absolute_dot(lp, offset);          pos = find_dot(lp, offset);
   
         /*          /*
          * We try to reuse the last undo record to `compress' things.           * We try to reuse the last undo record to `compress' things.
Line 263 
Line 263 
         reg.r_offset = offset;          reg.r_offset = offset;
         reg.r_size = size;          reg.r_size = size;
   
         pos = find_absolute_dot(lp, offset);          pos = find_dot(lp, offset);
   
         if (offset == llength(lp))      /* if it's a newline... */          if (offset == llength(lp))      /* if it's a newline... */
                 undo_add_boundary();                  undo_add_boundary();
Line 413 
Line 413 
         LINE *lp;          LINE *lp;
         int offset, save, dot;          int offset, save, dot;
   
         dot = find_absolute_dot(curwp->w_dotp, curwp->w_doto);          dot = find_dot(curwp->w_dotp, curwp->w_doto);
   
         ptr = curwp->w_undoptr;          ptr = curwp->w_undoptr;
   
Line 458 
Line 458 
                          * Move to where this has to apply                           * Move to where this has to apply
                          *                           *
                          * Boundaries are put as position 0 (to save                           * Boundaries are put as position 0 (to save
                          * lookup time in find_absolute_dot) so we must                           * lookup time in find_dot) so we must
                          * not move there...                           * not move there...
                          */                           */
                         if (ptr->type != BOUNDARY) {                          if (ptr->type != BOUNDARY) {
                                 if (find_line_offset(ptr->pos, &lp,                                  if (find_lo(ptr->pos, &lp,
                                     &offset) == FALSE) {                                      &offset) == FALSE) {
                                         ewprintf("Internal error in Undo!");                                          ewprintf("Internal error in Undo!");
                                         rval = FALSE;                                          rval = FALSE;
Line 505 
Line 505 
          */           */
         curwp->w_undoptr = ptr;          curwp->w_undoptr = ptr;
   
         curwp->w_undopos = find_absolute_dot(curwp->w_dotp, curwp->w_doto);          curwp->w_undopos = find_dot(curwp->w_dotp, curwp->w_doto);
   
         return (rval);          return (rval);
 }  }

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24