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

Diff for /src/usr.bin/mg/re_search.c between version 1.28 and 1.29

version 1.28, 2013/09/24 13:29:51 version 1.29, 2013/12/20 18:44:13
Line 300 
Line 300 
 static int  static int
 re_forwsrch(void)  re_forwsrch(void)
 {  {
         int      tbo, error;          int      tbo, tdotline, error;
         struct line     *clp;          struct line     *clp;
   
         clp = curwp->w_dotp;          clp = curwp->w_dotp;
         tbo = curwp->w_doto;          tbo = curwp->w_doto;
           tdotline = curwp->w_dotline;
   
         if (tbo == clp->l_used)          if (tbo == clp->l_used)
                 /*                  /*
Line 313 
Line 314 
                  */                   */
                 if (clp != curbp->b_headp) {                  if (clp != curbp->b_headp) {
                         clp = lforw(clp);                          clp = lforw(clp);
                           tdotline++;
                         tbo = 0;                          tbo = 0;
                 }                  }
         /*          /*
Line 326 
Line 328 
                     REG_STARTEND);                      REG_STARTEND);
                 if (error != 0) {                  if (error != 0) {
                         clp = lforw(clp);                          clp = lforw(clp);
                           tdotline++;
                         tbo = 0;                          tbo = 0;
                 } else {                  } else {
                         curwp->w_doto = regex_match[0].rm_eo;                          curwp->w_doto = regex_match[0].rm_eo;
                         curwp->w_dotp = clp;                          curwp->w_dotp = clp;
                           curwp->w_dotline = tdotline;
                         curwp->w_rflag |= WFMOVE;                          curwp->w_rflag |= WFMOVE;
                         return (TRUE);                          return (TRUE);
                 }                  }
Line 347 
Line 351 
 re_backsrch(void)  re_backsrch(void)
 {  {
         struct line             *clp;          struct line             *clp;
         int              tbo;          int              tbo, tdotline;
         regmatch_t       lastmatch;          regmatch_t       lastmatch;
   
         clp = curwp->w_dotp;          clp = curwp->w_dotp;
         tbo = curwp->w_doto;          tbo = curwp->w_doto;
           tdotline = curwp->w_dotline;
   
         /* Start search one position to the left of dot */          /* Start search one position to the left of dot */
         tbo = tbo - 1;          tbo = tbo - 1;
         if (tbo < 0) {          if (tbo < 0) {
                 /* must move up one line */                  /* must move up one line */
                 clp = lback(clp);                  clp = lback(clp);
                   tdotline--;
                 tbo = llength(clp);                  tbo = llength(clp);
         }          }
   
Line 383 
Line 389 
                 }                  }
                 if (lastmatch.rm_so == -1) {                  if (lastmatch.rm_so == -1) {
                         clp = lback(clp);                          clp = lback(clp);
                           tdotline--;
                         tbo = llength(clp);                          tbo = llength(clp);
                 } else {                  } else {
                         memcpy(&regex_match[0], &lastmatch, sizeof(regmatch_t));                          memcpy(&regex_match[0], &lastmatch, sizeof(regmatch_t));
                         curwp->w_doto = regex_match[0].rm_so;                          curwp->w_doto = regex_match[0].rm_so;
                         curwp->w_dotp = clp;                          curwp->w_dotp = clp;
                           curwp->w_dotline = tdotline;
                         curwp->w_rflag |= WFMOVE;                          curwp->w_rflag |= WFMOVE;
                         return (TRUE);                          return (TRUE);
                 }                  }

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29