[BACK]Return to chared.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libedit

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libedit/chared.c between version 1.31 and 1.32

version 1.31, 2011/07/28 20:50:55 version 1.32, 2011/07/29 15:16:33
Line 201  c_delbefore1(EditLine *el)
Line 201  c_delbefore1(EditLine *el)
 protected int  protected int
 ce__isword(Int p)  ce__isword(Int p)
 {  {
         return (Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL);          return Isalnum(p || Strchr(STR("*?_-.[]~="), p) != NULL);
 }  }
   
   
Line 225  cv__isword(Int p)
Line 225  cv__isword(Int p)
 protected int  protected int
 cv__isWord(Int p)  cv__isWord(Int p)
 {  {
         return (!Isspace(p));          return !Isspace(p);
 }  }
   
   
Line 249  c__prev_word(Char *p, Char *low, int n, 
Line 249  c__prev_word(Char *p, Char *low, int n, 
         if (p < low)          if (p < low)
                 p = low;                  p = low;
         /* cp now points where we want it */          /* cp now points where we want it */
         return (p);          return p;
 }  }
   
   
Line 268  c__next_word(Char *p, Char *high, int n,
Line 268  c__next_word(Char *p, Char *high, int n,
         if (p > high)          if (p > high)
                 p = high;                  p = high;
         /* p now points where we want it */          /* p now points where we want it */
         return (p);          return p;
 }  }
   
 /* cv_next_word():  /* cv_next_word():
Line 294  cv_next_word(EditLine *el, Char *p, Char
Line 294  cv_next_word(EditLine *el, Char *p, Char
   
         /* p now points where we want it */          /* p now points where we want it */
         if (p > high)          if (p > high)
                 return (high);                  return high;
         else          else
                 return (p);                  return p;
 }  }
   
   
Line 320  cv_prev_word(Char *p, Char *low, int n, 
Line 320  cv_prev_word(Char *p, Char *low, int n, 
   
         /* p now points where we want it */          /* p now points where we want it */
         if (p < low)          if (p < low)
                 return (low);                  return low;
         else          else
                 return (p);                  return p;
 }  }
   
   
Line 343  c__number(
Line 343  c__number(
   
         if (*++p == '^') {          if (*++p == '^') {
                 *num = 1;                  *num = 1;
                 return (p);                  return p;
         }          }
         if (*p == '$') {          if (*p == '$') {
                 if (*++p != '-') {                  if (*++p != '-') {
                         *num = 0x7fffffff;      /* Handle $ */                          *num = 0x7fffffff;      /* Handle $ */
                         return (--p);                          return --p;
                 }                  }
                 sign = -1;                      /* Handle $- */                  sign = -1;                      /* Handle $- */
                 ++p;                  ++p;
Line 357  c__number(
Line 357  c__number(
         for (i = 0; Isdigit(*p); i = 10 * i + *p++ - '0')          for (i = 0; Isdigit(*p); i = 10 * i + *p++ - '0')
                 continue;                  continue;
         *num = (sign < 0 ? dval - i : i);          *num = (sign < 0 ? dval - i : i);
         return (--p);          return --p;
 }  }
 #endif  #endif
   
Line 416  ce__endword(Char *p, Char *high, int n)
Line 416  ce__endword(Char *p, Char *high, int n)
         }          }
   
         p--;          p--;
         return (p);          return p;
 }  }
 #endif  #endif
   
Line 440  cv__endword(Char *p, Char *high, int n, 
Line 440  cv__endword(Char *p, Char *high, int n, 
                         p++;                          p++;
         }          }
         p--;          p--;
         return (p);          return p;
 }  }
   
 /* ch_init():  /* ch_init():
Line 454  ch_init(EditLine *el)
Line 454  ch_init(EditLine *el)
         el->el_line.buffer              = el_malloc(EL_BUFSIZ *          el->el_line.buffer              = el_malloc(EL_BUFSIZ *
             sizeof(*el->el_line.buffer));              sizeof(*el->el_line.buffer));
         if (el->el_line.buffer == NULL)          if (el->el_line.buffer == NULL)
                 return (-1);                  return -1;
   
         (void) memset(el->el_line.buffer, 0, EL_BUFSIZ *          (void) memset(el->el_line.buffer, 0, EL_BUFSIZ *
             sizeof(*el->el_line.buffer));              sizeof(*el->el_line.buffer));
Line 465  ch_init(EditLine *el)
Line 465  ch_init(EditLine *el)
         el->el_chared.c_undo.buf        = el_malloc(EL_BUFSIZ *          el->el_chared.c_undo.buf        = el_malloc(EL_BUFSIZ *
             sizeof(*el->el_chared.c_undo.buf));              sizeof(*el->el_chared.c_undo.buf));
         if (el->el_chared.c_undo.buf == NULL)          if (el->el_chared.c_undo.buf == NULL)
                 return (-1);                  return -1;
         (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ *          (void) memset(el->el_chared.c_undo.buf, 0, EL_BUFSIZ *
             sizeof(*el->el_chared.c_undo.buf));              sizeof(*el->el_chared.c_undo.buf));
         el->el_chared.c_undo.len        = -1;          el->el_chared.c_undo.len        = -1;
Line 473  ch_init(EditLine *el)
Line 473  ch_init(EditLine *el)
         el->el_chared.c_redo.buf        = el_malloc(EL_BUFSIZ *          el->el_chared.c_redo.buf        = el_malloc(EL_BUFSIZ *
             sizeof(*el->el_chared.c_redo.buf));              sizeof(*el->el_chared.c_redo.buf));
         if (el->el_chared.c_redo.buf == NULL)          if (el->el_chared.c_redo.buf == NULL)
                 return (-1);                  return -1;
         el->el_chared.c_redo.pos        = el->el_chared.c_redo.buf;          el->el_chared.c_redo.pos        = el->el_chared.c_redo.buf;
         el->el_chared.c_redo.lim        = el->el_chared.c_redo.buf + EL_BUFSIZ;          el->el_chared.c_redo.lim        = el->el_chared.c_redo.buf + EL_BUFSIZ;
         el->el_chared.c_redo.cmd        = ED_UNASSIGNED;          el->el_chared.c_redo.cmd        = ED_UNASSIGNED;
Line 484  ch_init(EditLine *el)
Line 484  ch_init(EditLine *el)
         el->el_chared.c_kill.buf        = el_malloc(EL_BUFSIZ *          el->el_chared.c_kill.buf        = el_malloc(EL_BUFSIZ *
             sizeof(*el->el_chared.c_kill.buf));              sizeof(*el->el_chared.c_kill.buf));
         if (el->el_chared.c_kill.buf == NULL)          if (el->el_chared.c_kill.buf == NULL)
                 return (-1);                  return -1;
         (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ *          (void) memset(el->el_chared.c_kill.buf, 0, EL_BUFSIZ *
             sizeof(*el->el_chared.c_kill.buf));              sizeof(*el->el_chared.c_kill.buf));
         el->el_chared.c_kill.mark       = el->el_line.buffer;          el->el_chared.c_kill.mark       = el->el_line.buffer;
Line 504  ch_init(EditLine *el)
Line 504  ch_init(EditLine *el)
         ma->offset      = 0;          ma->offset      = 0;
         ma->macro       = el_malloc(EL_MAXMACRO * sizeof(*ma->macro));          ma->macro       = el_malloc(EL_MAXMACRO * sizeof(*ma->macro));
         if (ma->macro == NULL)          if (ma->macro == NULL)
                 return (-1);                  return -1;
         return (0);          return 0;
 }  }
   
 /* ch_reset():  /* ch_reset():
Line 670  FUN(el,insertstr)(EditLine *el, const Ch
Line 670  FUN(el,insertstr)(EditLine *el, const Ch
         size_t len;          size_t len;
   
         if ((len = Strlen(s)) == 0)          if ((len = Strlen(s)) == 0)
                 return (-1);                  return -1;
         if (el->el_line.lastchar + len >= el->el_line.limit) {          if (el->el_line.lastchar + len >= el->el_line.limit) {
                 if (!ch_enlargebufs(el, len))                  if (!ch_enlargebufs(el, len))
                         return (-1);                          return -1;
         }          }
   
         c_insert(el, (int)len);          c_insert(el, (int)len);
         while (*s)          while (*s)
                 *el->el_line.cursor++ = *s++;                  *el->el_line.cursor++ = *s++;
         return (0);          return 0;
 }  }
   
   
Line 778  c_hpos(EditLine *el)
Line 778  c_hpos(EditLine *el)
          * Find how many characters till the beginning of this line.           * Find how many characters till the beginning of this line.
          */           */
         if (el->el_line.cursor == el->el_line.buffer)          if (el->el_line.cursor == el->el_line.buffer)
                 return (0);                  return 0;
         else {          else {
                 for (ptr = el->el_line.cursor - 1;                  for (ptr = el->el_line.cursor - 1;
                      ptr >= el->el_line.buffer && *ptr != '\n';                       ptr >= el->el_line.buffer && *ptr != '\n';

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

CVSweb <webmaster@jp.NetBSD.org>