[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.34 and 1.35

version 1.34, 2005/11/18 17:11:21 version 1.35, 2005/11/18 20:56:53
Line 49 
Line 49 
 /*  /*
  * Local functions   * Local functions
  */   */
 static int find_dot(LINE *, int);  static int find_dot(struct line *, int);
 static int find_lo(int, LINE **, int *);  static int find_lo(int, struct 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);
   
Line 63 
Line 63 
  * need to have an absolute dot to have something reliable.   * need to have an absolute dot to have something reliable.
  */   */
 static int  static int
 find_dot(LINE *lp, int off)  find_dot(struct line *lp, int off)
 {  {
         int      count = 0;          int      count = 0;
         LINE    *p;          struct line     *p;
   
         for (p = curbp->b_linep; p != lp; p = lforw(p)) {          for (p = curbp->b_linep; p != lp; p = lforw(p)) {
                 if (count != 0) {                  if (count != 0) {
Line 84 
Line 84 
 }  }
   
 static int  static int
 find_lo(int pos, LINE **olp, int *offset)  find_lo(int pos, struct line **olp, int *offset)
 {  {
         LINE *p;          struct line *p;
   
         p = curbp->b_linep;          p = curbp->b_linep;
         while (pos > llength(p)) {          while (pos > llength(p)) {
Line 225 
Line 225 
 }  }
   
 int  int
 undo_add_insert(LINE *lp, int offset, int size)  undo_add_insert(struct line *lp, int offset, int size)
 {  {
         REGION  reg;          struct region   reg;
         struct  undo_rec *rec;          struct  undo_rec *rec;
         int     pos;          int     pos;
   
Line 256 
Line 256 
         rec = new_undo_record();          rec = new_undo_record();
         rec->pos = pos;          rec->pos = pos;
         rec->type = INSERT;          rec->type = INSERT;
         memmove(&rec->region, &reg, sizeof(REGION));          memmove(&rec->region, &reg, sizeof(struct region));
         rec->content = NULL;          rec->content = NULL;
   
         undo_add_boundary();          undo_add_boundary();
Line 270 
Line 270 
  * This of course must be done _before_ the actual deletion is done.   * This of course must be done _before_ the actual deletion is done.
  */   */
 int  int
 undo_add_delete(LINE *lp, int offset, int size)  undo_add_delete(struct line *lp, int offset, int size)
 {  {
         REGION  reg;          struct region   reg;
         struct  undo_rec *rec;          struct  undo_rec *rec;
         int     pos;          int     pos;
   
Line 301 
Line 301 
         rec->pos = pos;          rec->pos = pos;
   
         rec->type = DELETE;          rec->type = DELETE;
         memmove(&rec->region, &reg, sizeof(REGION));          memmove(&rec->region, &reg, sizeof(struct region));
         do {          do {
                 rec->content = malloc(reg.r_size + 1);                  rec->content = malloc(reg.r_size + 1);
         } while ((rec->content == NULL) && drop_oldest_undo_record());          } while ((rec->content == NULL) && drop_oldest_undo_record());
Line 323 
Line 323 
  * This of course must be called before the change takes place.   * This of course must be called before the change takes place.
  */   */
 int  int
 undo_add_change(LINE *lp, int offset, int size)  undo_add_change(struct line *lp, int offset, int size)
 {  {
         if (undo_disable_flag)          if (undo_disable_flag)
                 return (TRUE);                  return (TRUE);
Line 345 
Line 345 
 undo_dump(int f, int n)  undo_dump(int f, int n)
 {  {
         struct   undo_rec *rec;          struct   undo_rec *rec;
         BUFFER  *bp;          struct buffer   *bp;
         MGWIN   *wp;          struct mgwin    *wp;
         char     buf[4096], tmp[1024];          char     buf[4096], tmp[1024];
         int      num;          int      num;
   
Line 435 
Line 435 
 {  {
         struct undo_rec *ptr, *nptr;          struct undo_rec *ptr, *nptr;
         int              done, rval;          int              done, rval;
         LINE            *lp;          struct line             *lp;
         int              offset, save, dot;          int              offset, save, dot;
         static int       nulled = FALSE;          static int       nulled = FALSE;
   

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35