Patch 8.0.0147
Summary:    searchpair() fails when 'magic' is off
Problem:    searchpair() does not work when 'magic' is off. (Chris Paul)
Solution:   Add \m in the pattern. (Christian Brabandt, closes #1341)
Files:      src/evalfunc.c, src/testdir/test_search.vim


*** ../vim-8.0.0146/src/evalfunc.c      2017-01-06 13:54:27.474326599 +0100
--- src/evalfunc.c      2017-01-06 19:59:18.872647757 +0100
***************
*** 9509,9523 ****
  
      /* Make two search patterns: start/end (pat2, for in nested pairs) and
       * start/middle/end (pat3, for the top pair). */
!     pat2 = alloc((unsigned)(STRLEN(spat) + STRLEN(epat) + 15));
!     pat3 = alloc((unsigned)(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 23));
      if (pat2 == NULL || pat3 == NULL)
        goto theend;
!     sprintf((char *)pat2, "\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat);
      if (*mpat == NUL)
        STRCPY(pat3, pat2);
      else
!       sprintf((char *)pat3, "\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)",
                                                            spat, epat, mpat);
      if (flags & SP_START)
        options |= SEARCH_START;
--- 9509,9523 ----
  
      /* Make two search patterns: start/end (pat2, for in nested pairs) and
       * start/middle/end (pat3, for the top pair). */
!     pat2 = alloc((unsigned)(STRLEN(spat) + STRLEN(epat) + 17));
!     pat3 = alloc((unsigned)(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25));
      if (pat2 == NULL || pat3 == NULL)
        goto theend;
!     sprintf((char *)pat2, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat);
      if (*mpat == NUL)
        STRCPY(pat3, pat2);
      else
!       sprintf((char *)pat3, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)",
                                                            spat, epat, mpat);
      if (flags & SP_START)
        options |= SEARCH_START;
*** ../vim-8.0.0146/src/testdir/test_search.vim 2016-09-09 21:20:43.000000000 
+0200
--- src/testdir/test_search.vim 2017-01-06 19:58:58.108795717 +0100
***************
*** 279,281 ****
--- 279,296 ----
    call X()
    bwipe!
  endfunc
+ 
+ func Test_searchpair()
+   new
+   call setline(1, ['other code here', '', '[', '" cursor here', ']'])
+   4
+   let a=searchpair('\[','',']','bW')
+   call assert_equal(3, a)
+   set nomagic
+   4
+   let a=searchpair('\[','',']','bW')
+   call assert_equal(3, a)
+   set magic
+   q!
+ endfunc
+ 
*** ../vim-8.0.0146/src/version.c       2017-01-06 18:16:15.632490849 +0100
--- src/version.c       2017-01-06 19:58:30.296993909 +0100
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     147,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
198. You read all the quotes at Netaholics Anonymous and keep thinking
     "What's wrong with that?"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui