diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-08-06 19:09:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-08-06 19:09:16 +0200 |
commit | e98cfe1cc9c1f63fc280452593b4b4cbfe2f6356 (patch) | |
tree | 7975f2d8c86ce7b3e8947ebc09763ea179fbedb2 | |
parent | 6b1ee34aa0236b50f675f3bbcd9bf0b7a3384f7f (diff) | |
download | vim-e98cfe1cc9c1f63fc280452593b4b4cbfe2f6356.zip |
updated for version 7.4.397
Problem: Matchparen only uses the topmost syntax item.
Solution: Go through the syntax stack to find items. (James McCoy)
Also use getcurpos() when possible.
-rw-r--r-- | runtime/plugin/matchparen.vim | 13 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 817ce62b2..3804ab949 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -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. diff --git a/src/version.c b/src/version.c index 312e4abb6..878ace89d 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 397, +/**/ 396, /**/ 395, |