home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.265 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  3.9 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.265
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.265
  11. Problem:    When storing a pattern in search history there is no proper check
  12.         for the separator character.
  13. Solution:   Pass the separator character to in_history(). (Muraoka Taro)
  14. Files:        src/ex_getln.c
  15.  
  16.  
  17. *** ../vim-7.3.264/src/ex_getln.c    2011-07-07 16:44:33.000000000 +0200
  18. --- src/ex_getln.c    2011-07-27 17:50:35.000000000 +0200
  19. ***************
  20. *** 67,73 ****
  21.   
  22.   static int    hist_char2type __ARGS((int c));
  23.   
  24. ! static int    in_history __ARGS((int, char_u *, int));
  25.   # ifdef FEAT_EVAL
  26.   static int    calc_hist_idx __ARGS((int histype, int num));
  27.   # endif
  28. --- 67,73 ----
  29.   
  30.   static int    hist_char2type __ARGS((int c));
  31.   
  32. ! static int    in_history __ARGS((int, char_u *, int, int));
  33.   # ifdef FEAT_EVAL
  34.   static int    calc_hist_idx __ARGS((int histype, int num));
  35.   # endif
  36. ***************
  37. *** 5289,5301 ****
  38.    * If 'move_to_front' is TRUE, matching entry is moved to end of history.
  39.    */
  40.       static int
  41. ! in_history(type, str, move_to_front)
  42.       int        type;
  43.       char_u  *str;
  44.       int        move_to_front;    /* Move the entry to the front if it exists */
  45.   {
  46.       int        i;
  47.       int        last_i = -1;
  48.   
  49.       if (hisidx[type] < 0)
  50.       return FALSE;
  51. --- 5289,5303 ----
  52.    * If 'move_to_front' is TRUE, matching entry is moved to end of history.
  53.    */
  54.       static int
  55. ! in_history(type, str, move_to_front, sep)
  56.       int        type;
  57.       char_u  *str;
  58.       int        move_to_front;    /* Move the entry to the front if it exists */
  59. +     int        sep;
  60.   {
  61.       int        i;
  62.       int        last_i = -1;
  63. +     char_u  *p;
  64.   
  65.       if (hisidx[type] < 0)
  66.       return FALSE;
  67. ***************
  68. *** 5304,5310 ****
  69.       {
  70.       if (history[type][i].hisstr == NULL)
  71.           return FALSE;
  72. !     if (STRCMP(str, history[type][i].hisstr) == 0)
  73.       {
  74.           if (!move_to_front)
  75.           return TRUE;
  76. --- 5306,5317 ----
  77.       {
  78.       if (history[type][i].hisstr == NULL)
  79.           return FALSE;
  80. !     /* For search history, check that the separator character matches as
  81. !      * well. */
  82. !     p = history[type][i].hisstr;
  83. !     if (STRCMP(str, p) == 0
  84. !         && (type != HIST_SEARCH || sep == p[STRLEN(p) + 1]))
  85.       {
  86.           if (!move_to_front)
  87.           return TRUE;
  88. ***************
  89. *** 5398,5404 ****
  90.       }
  91.       last_maptick = -1;
  92.       }
  93. !     if (!in_history(histype, new_entry, TRUE))
  94.       {
  95.       if (++hisidx[histype] == hislen)
  96.           hisidx[histype] = 0;
  97. --- 5405,5411 ----
  98.       }
  99.       last_maptick = -1;
  100.       }
  101. !     if (!in_history(histype, new_entry, TRUE, sep))
  102.       {
  103.       if (++hisidx[histype] == hislen)
  104.           hisidx[histype] = 0;
  105. ***************
  106. *** 5977,5983 ****
  107.       if (val != NULL && *val != NUL)
  108.       {
  109.           if (!in_history(type, val + (type == HIST_SEARCH),
  110. !                             viminfo_add_at_front))
  111.           {
  112.           /* Need to re-allocate to append the separator byte. */
  113.           len = STRLEN(val);
  114. --- 5984,5990 ----
  115.       if (val != NULL && *val != NUL)
  116.       {
  117.           if (!in_history(type, val + (type == HIST_SEARCH),
  118. !                           viminfo_add_at_front, *val))
  119.           {
  120.           /* Need to re-allocate to append the separator byte. */
  121.           len = STRLEN(val);
  122. *** ../vim-7.3.264/src/version.c    2011-07-27 17:31:42.000000000 +0200
  123. --- src/version.c    2011-07-27 17:58:22.000000000 +0200
  124. ***************
  125. *** 711,712 ****
  126. --- 711,714 ----
  127.   {   /* Add new patch number below this line */
  128. + /**/
  129. +     265,
  130.   /**/
  131.  
  132. -- 
  133.     [clop clop]
  134. MORTICIAN:  Who's that then?
  135. CUSTOMER:   I don't know.
  136. MORTICIAN:  Must be a king.
  137. CUSTOMER:   Why?
  138. MORTICIAN:  He hasn't got shit all over him.
  139.                                   The Quest for the Holy Grail (Monty Python)
  140.  
  141.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  142. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  143. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  144.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  145.