|
|
073263 |
To: vim_dev@googlegroups.com
|
|
|
073263 |
Subject: Patch 7.4.397
|
|
|
073263 |
Fcc: outbox
|
|
|
073263 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
073263 |
Mime-Version: 1.0
|
|
|
073263 |
Content-Type: text/plain; charset=UTF-8
|
|
|
073263 |
Content-Transfer-Encoding: 8bit
|
|
|
073263 |
------------
|
|
|
073263 |
|
|
|
073263 |
Patch 7.4.397
|
|
|
073263 |
Problem: Matchparen only uses the topmost syntax item.
|
|
|
073263 |
Solution: Go through the syntax stack to find items. (James McCoy)
|
|
|
073263 |
Also use getcurpos() when possible.
|
|
|
073263 |
Files: runtime/plugin/matchparen.vim
|
|
|
073263 |
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.396/runtime/plugin/matchparen.vim 2014-06-17 17:48:21.772628007 +0200
|
|
|
073263 |
--- runtime/plugin/matchparen.vim 2014-08-06 19:02:04.967128364 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1,6 ****
|
|
|
073263 |
" Vim plugin for showing matching parens
|
|
|
073263 |
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
|
|
073263 |
! " Last Change: 2014 Jun 17
|
|
|
073263 |
|
|
|
073263 |
" Exit quickly when:
|
|
|
073263 |
" - this plugin was already loaded (or disabled)
|
|
|
073263 |
--- 1,6 ----
|
|
|
073263 |
" Vim plugin for showing matching parens
|
|
|
073263 |
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
|
|
073263 |
! " Last Change: 2014 Jul 19
|
|
|
073263 |
|
|
|
073263 |
" Exit quickly when:
|
|
|
073263 |
" - this plugin was already loaded (or disabled)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 54,67 ****
|
|
|
073263 |
let c_col = col('.')
|
|
|
073263 |
let before = 0
|
|
|
073263 |
|
|
|
073263 |
! let c = getline(c_lnum)[c_col - 1]
|
|
|
073263 |
let plist = split(&matchpairs, '.\zs[:,]')
|
|
|
073263 |
let i = index(plist, c)
|
|
|
073263 |
if i < 0
|
|
|
073263 |
" not found, in Insert mode try character before the cursor
|
|
|
073263 |
if c_col > 1 && (mode() == 'i' || mode() == 'R')
|
|
|
073263 |
let before = 1
|
|
|
073263 |
! let c = getline(c_lnum)[c_col - 2]
|
|
|
073263 |
let i = index(plist, c)
|
|
|
073263 |
endif
|
|
|
073263 |
if i < 0
|
|
|
073263 |
--- 54,68 ----
|
|
|
073263 |
let c_col = col('.')
|
|
|
073263 |
let before = 0
|
|
|
073263 |
|
|
|
073263 |
! let text = getline(c_lnum)
|
|
|
073263 |
! let c = text[c_col - 1]
|
|
|
073263 |
let plist = split(&matchpairs, '.\zs[:,]')
|
|
|
073263 |
let i = index(plist, c)
|
|
|
073263 |
if i < 0
|
|
|
073263 |
" not found, in Insert mode try character before the cursor
|
|
|
073263 |
if c_col > 1 && (mode() == 'i' || mode() == 'R')
|
|
|
073263 |
let before = 1
|
|
|
073263 |
! let c = text[c_col - 2]
|
|
|
073263 |
let i = index(plist, c)
|
|
|
073263 |
endif
|
|
|
073263 |
if i < 0
|
|
|
073263 |
***************
|
|
|
073263 |
*** 87,100 ****
|
|
|
073263 |
" Find the match. When it was just before the cursor move it there for a
|
|
|
073263 |
" moment.
|
|
|
073263 |
if before > 0
|
|
|
073263 |
! let save_cursor = winsaveview()
|
|
|
073263 |
call cursor(c_lnum, c_col - before)
|
|
|
073263 |
endif
|
|
|
073263 |
|
|
|
073263 |
! " When not in a string or comment ignore matches inside them.
|
|
|
073263 |
" We match "escape" for special items, such as lispEscapeSpecial.
|
|
|
073263 |
! let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
|
|
|
073263 |
! \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
|
|
|
073263 |
execute 'if' s_skip '| let s_skip = 0 | endif'
|
|
|
073263 |
|
|
|
073263 |
" Limit the search to lines visible in the window.
|
|
|
073263 |
--- 88,114 ----
|
|
|
073263 |
" Find the match. When it was just before the cursor move it there for a
|
|
|
073263 |
" moment.
|
|
|
073263 |
if before > 0
|
|
|
073263 |
! let has_getcurpos = exists("*getcurpos")
|
|
|
073263 |
! if has_getcurpos
|
|
|
073263 |
! " getcurpos() is more efficient but doesn't exist before 7.4.313.
|
|
|
073263 |
! let save_cursor = getcurpos()
|
|
|
073263 |
! else
|
|
|
073263 |
! let save_cursor = winsaveview()
|
|
|
073263 |
! endif
|
|
|
073263 |
call cursor(c_lnum, c_col - before)
|
|
|
073263 |
endif
|
|
|
073263 |
|
|
|
073263 |
! " Build an expression that detects whether the current cursor position is in
|
|
|
073263 |
! " certain syntax types (string, comment, etc.), for use as searchpairpos()'s
|
|
|
073263 |
! " skip argument.
|
|
|
073263 |
" We match "escape" for special items, such as lispEscapeSpecial.
|
|
|
073263 |
! let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
|
|
|
073263 |
! \ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
|
|
|
073263 |
! " If executing the expression determines that the cursor is currently in
|
|
|
073263 |
! " one of the syntax types, then we want searchpairpos() to find the pair
|
|
|
073263 |
! " within those syntax types (i.e., not skip). Otherwise, the cursor is
|
|
|
073263 |
! " outside of the syntax types and s_skip should keep its value so we skip any
|
|
|
073263 |
! " matching pair inside the syntax types.
|
|
|
073263 |
execute 'if' s_skip '| let s_skip = 0 | endif'
|
|
|
073263 |
|
|
|
073263 |
" Limit the search to lines visible in the window.
|
|
|
073263 |
***************
|
|
|
073263 |
*** 147,153 ****
|
|
|
073263 |
endtry
|
|
|
073263 |
|
|
|
073263 |
if before > 0
|
|
|
073263 |
! call winrestview(save_cursor)
|
|
|
073263 |
endif
|
|
|
073263 |
|
|
|
073263 |
" If a match is found setup match highlighting.
|
|
|
073263 |
--- 161,171 ----
|
|
|
073263 |
endtry
|
|
|
073263 |
|
|
|
073263 |
if before > 0
|
|
|
073263 |
! if has_getcurpos
|
|
|
073263 |
! call setpos('.', save_cursor)
|
|
|
073263 |
! else
|
|
|
073263 |
! call winrestview(save_cursor)
|
|
|
073263 |
! endif
|
|
|
073263 |
endif
|
|
|
073263 |
|
|
|
073263 |
" If a match is found setup match highlighting.
|
|
|
073263 |
*** ../vim-7.4.396/src/version.c 2014-08-06 18:17:03.475147780 +0200
|
|
|
073263 |
--- src/version.c 2014-08-06 19:06:44.627126354 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 743,744 ****
|
|
|
073263 |
--- 743,746 ----
|
|
|
073263 |
{ /* Add new patch number below this line */
|
|
|
073263 |
+ /**/
|
|
|
073263 |
+ 397,
|
|
|
073263 |
/**/
|
|
|
073263 |
|
|
|
073263 |
--
|
|
|
073263 |
Often you're less important than your furniture. If you think about it, you
|
|
|
073263 |
can get fired but your furniture stays behind, gainfully employed at the
|
|
|
073263 |
company that didn't need _you_ anymore.
|
|
|
073263 |
(Scott Adams - The Dilbert principle)
|
|
|
073263 |
|
|
|
073263 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
073263 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
073263 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
073263 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|