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.4 / 7.4.532 < prev    next >
Encoding:
Internet Message Format  |  2014-11-27  |  4.1 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.532
  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.4.532
  11. Problem:    When using 'incsearch' "2/pattern/e" highlights the first match.
  12. Solution:   Move the code to set extra_col inside the loop for count.  (Ozaki
  13.         Kiichi)
  14. Files:        src/search.c
  15.  
  16.  
  17. *** ../vim-7.4.531/src/search.c    2014-06-17 13:50:06.148087184 +0200
  18. --- src/search.c    2014-11-27 17:21:49.579489220 +0100
  19. ***************
  20. *** 552,557 ****
  21. --- 552,558 ----
  22.       int        match_ok;
  23.       long    nmatched;
  24.       int        submatch = 0;
  25. +     int        first_match = TRUE;
  26.       int        save_called_emsg = called_emsg;
  27.   #ifdef FEAT_SEARCH_EXTRA
  28.       int        break_loop = FALSE;
  29. ***************
  30. *** 565,597 ****
  31.       return FAIL;
  32.       }
  33.   
  34. -     /* When not accepting a match at the start position set "extra_col" to a
  35. -      * non-zero value.  Don't do that when starting at MAXCOL, since MAXCOL +
  36. -      * 1 is zero. */
  37. -     if ((options & SEARCH_START) || pos->col == MAXCOL)
  38. -     extra_col = 0;
  39. - #ifdef FEAT_MBYTE
  40. -     /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
  41. -     else if (dir != BACKWARD && has_mbyte
  42. -             && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
  43. -                              && pos->col < MAXCOL - 2)
  44. -     {
  45. -     ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
  46. -     if (*ptr == NUL)
  47. -         extra_col = 1;
  48. -     else
  49. -         extra_col = (*mb_ptr2len)(ptr);
  50. -     }
  51. - #endif
  52. -     else
  53. -     extra_col = 1;
  54.       /*
  55.        * find the string
  56.        */
  57.       called_emsg = FALSE;
  58.       do    /* loop for count */
  59.       {
  60.       start_pos = *pos;    /* remember start pos for detecting no match */
  61.       found = 0;        /* default: not found */
  62.       at_first_line = TRUE;    /* default: start in first line */
  63. --- 566,598 ----
  64.       return FAIL;
  65.       }
  66.   
  67.       /*
  68.        * find the string
  69.        */
  70.       called_emsg = FALSE;
  71.       do    /* loop for count */
  72.       {
  73. +     /* When not accepting a match at the start position set "extra_col" to
  74. +      * a non-zero value.  Don't do that when starting at MAXCOL, since
  75. +      * MAXCOL + 1 is zero. */
  76. +     if ((options & SEARCH_START) || pos->col == MAXCOL)
  77. +         extra_col = 0;
  78. + #ifdef FEAT_MBYTE
  79. +     /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */
  80. +     else if (dir != BACKWARD && has_mbyte
  81. +              && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
  82. +                              && pos->col < MAXCOL - 2)
  83. +     {
  84. +         ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
  85. +         if (*ptr == NUL)
  86. +         extra_col = 1;
  87. +         else
  88. +         extra_col = (*mb_ptr2len)(ptr);
  89. +     }
  90. + #endif
  91. +     else
  92. +         extra_col = 1;
  93.       start_pos = *pos;    /* remember start pos for detecting no match */
  94.       found = 0;        /* default: not found */
  95.       at_first_line = TRUE;    /* default: start in first line */
  96. ***************
  97. *** 677,683 ****
  98.                * otherwise "/$" will get stuck on end of line.
  99.                */
  100.               while (matchpos.lnum == 0
  101. !                 && ((options & SEARCH_END)
  102.                       ?  (nmatched == 1
  103.                       && (int)endpos.col - 1
  104.                            < (int)start_pos.col + extra_col)
  105. --- 678,684 ----
  106.                * otherwise "/$" will get stuck on end of line.
  107.                */
  108.               while (matchpos.lnum == 0
  109. !                 && ((options & SEARCH_END) && first_match
  110.                       ?  (nmatched == 1
  111.                       && (int)endpos.col - 1
  112.                            < (int)start_pos.col + extra_col)
  113. ***************
  114. *** 908,913 ****
  115. --- 909,915 ----
  116.               pos->coladd = 0;
  117.   #endif
  118.               found = 1;
  119. +             first_match = FALSE;
  120.   
  121.               /* Set variables used for 'incsearch' highlighting. */
  122.               search_match_lines = endpos.lnum - matchpos.lnum;
  123. *** ../vim-7.4.531/src/version.c    2014-11-27 16:38:07.652261234 +0100
  124. --- src/version.c    2014-11-27 17:29:13.762616760 +0100
  125. ***************
  126. *** 743,744 ****
  127. --- 743,746 ----
  128.   {   /* Add new patch number below this line */
  129. + /**/
  130. +     532,
  131.   /**/
  132.  
  133. -- 
  134. The most powerful force in the universe is gossip.
  135.  
  136.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  137. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  138. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  139.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  140.