]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.397 v7.4.397
authorBram Moolenaar <Bram@vim.org>
Wed, 6 Aug 2014 17:09:16 +0000 (19:09 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 6 Aug 2014 17:09:16 +0000 (19:09 +0200)
Problem:    Matchparen only uses the topmost syntax item.
Solution:   Go through the syntax stack to find items. (James McCoy)
            Also use getcurpos() when possible.

runtime/plugin/matchparen.vim
src/version.c

index 817ce62b283e2727938e8c2277f428ae176961f5..3804ab949a8e361b9148354a42ea9ff59874dd69 100644 (file)
@@ -98,10 +98,17 @@ function! s:Highlight_Matching_Pair()
     call cursor(c_lnum, c_col - before)
   endif
 
-  " When not in a string or comment ignore matches inside them.
+  " Build an expression that detects whether the current cursor position is in
+  " certain syntax types (string, comment, etc.), for use as searchpairpos()'s
+  " skip argument.
   " We match "escape" for special items, such as lispEscapeSpecial.
-  let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
-       \ '=~?  "string\\|character\\|singlequote\\|escape\\|comment"'
+  let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
+       \ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
+  " If executing the expression determines that the cursor is currently in
+  " one of the syntax types, then we want searchpairpos() to find the pair
+  " within those syntax types (i.e., not skip).  Otherwise, the cursor is
+  " outside of the syntax types and s_skip should keep its value so we skip any
+  " matching pair inside the syntax types.
   execute 'if' s_skip '| let s_skip = 0 | endif'
 
   " Limit the search to lines visible in the window.
index 312e4abb60ae6bbcb77e447107495bfbee52a7db..878ace89d422845090b0286c455d26baeb04b7bf 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    397,
 /**/
     396,
 /**/