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