home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.4 / 7.4.397 < prev    next >
Encoding:
Internet Message Format  |  2014-08-05  |  4.9 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.397
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.4.397
  11. Problem:    Matchparen only uses the topmost syntax item.
  12. Solution:   Go through the syntax stack to find items. (James McCoy)
  13.             Also use getcurpos() when possible.
  14. Files:      runtime/plugin/matchparen.vim
  15.  
  16.  
  17. *** ../vim-7.4.396/runtime/plugin/matchparen.vim    2014-06-17 17:48:21.772628007 +0200
  18. --- runtime/plugin/matchparen.vim    2014-08-06 19:02:04.967128364 +0200
  19. ***************
  20. *** 1,6 ****
  21.   " Vim plugin for showing matching parens
  22.   " Maintainer:  Bram Moolenaar <Bram@vim.org>
  23. ! " Last Change: 2014 Jun 17
  24.   
  25.   " Exit quickly when:
  26.   " - this plugin was already loaded (or disabled)
  27. --- 1,6 ----
  28.   " Vim plugin for showing matching parens
  29.   " Maintainer:  Bram Moolenaar <Bram@vim.org>
  30. ! " Last Change: 2014 Jul 19
  31.   
  32.   " Exit quickly when:
  33.   " - this plugin was already loaded (or disabled)
  34. ***************
  35. *** 54,67 ****
  36.     let c_col = col('.')
  37.     let before = 0
  38.   
  39. !   let c = getline(c_lnum)[c_col - 1]
  40.     let plist = split(&matchpairs, '.\zs[:,]')
  41.     let i = index(plist, c)
  42.     if i < 0
  43.       " not found, in Insert mode try character before the cursor
  44.       if c_col > 1 && (mode() == 'i' || mode() == 'R')
  45.         let before = 1
  46. !       let c = getline(c_lnum)[c_col - 2]
  47.         let i = index(plist, c)
  48.       endif
  49.       if i < 0
  50. --- 54,68 ----
  51.     let c_col = col('.')
  52.     let before = 0
  53.   
  54. !   let text = getline(c_lnum)
  55. !   let c = text[c_col - 1]
  56.     let plist = split(&matchpairs, '.\zs[:,]')
  57.     let i = index(plist, c)
  58.     if i < 0
  59.       " not found, in Insert mode try character before the cursor
  60.       if c_col > 1 && (mode() == 'i' || mode() == 'R')
  61.         let before = 1
  62. !       let c = text[c_col - 2]
  63.         let i = index(plist, c)
  64.       endif
  65.       if i < 0
  66. ***************
  67. *** 87,100 ****
  68.     " Find the match.  When it was just before the cursor move it there for a
  69.     " moment.
  70.     if before > 0
  71. !     let save_cursor = winsaveview()
  72.       call cursor(c_lnum, c_col - before)
  73.     endif
  74.   
  75. !   " When not in a string or comment ignore matches inside them.
  76.     " We match "escape" for special items, such as lispEscapeSpecial.
  77. !   let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
  78. !     \ '=~?  "string\\|character\\|singlequote\\|escape\\|comment"'
  79.     execute 'if' s_skip '| let s_skip = 0 | endif'
  80.   
  81.     " Limit the search to lines visible in the window.
  82. --- 88,114 ----
  83.     " Find the match.  When it was just before the cursor move it there for a
  84.     " moment.
  85.     if before > 0
  86. !     let has_getcurpos = exists("*getcurpos")
  87. !     if has_getcurpos
  88. !       " getcurpos() is more efficient but doesn't exist before 7.4.313.
  89. !       let save_cursor = getcurpos()
  90. !     else
  91. !       let save_cursor = winsaveview()
  92. !     endif
  93.       call cursor(c_lnum, c_col - before)
  94.     endif
  95.   
  96. !   " Build an expression that detects whether the current cursor position is in
  97. !   " certain syntax types (string, comment, etc.), for use as searchpairpos()'s
  98. !   " skip argument.
  99.     " We match "escape" for special items, such as lispEscapeSpecial.
  100. !   let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
  101. !     \ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
  102. !   " If executing the expression determines that the cursor is currently in
  103. !   " one of the syntax types, then we want searchpairpos() to find the pair
  104. !   " within those syntax types (i.e., not skip).  Otherwise, the cursor is
  105. !   " outside of the syntax types and s_skip should keep its value so we skip any
  106. !   " matching pair inside the syntax types.
  107.     execute 'if' s_skip '| let s_skip = 0 | endif'
  108.   
  109.     " Limit the search to lines visible in the window.
  110. ***************
  111. *** 147,153 ****
  112.     endtry
  113.   
  114.     if before > 0
  115. !     call winrestview(save_cursor)
  116.     endif
  117.   
  118.     " If a match is found setup match highlighting.
  119. --- 161,171 ----
  120.     endtry
  121.   
  122.     if before > 0
  123. !     if has_getcurpos
  124. !       call setpos('.', save_cursor)
  125. !     else
  126. !       call winrestview(save_cursor)
  127. !     endif
  128.     endif
  129.   
  130.     " If a match is found setup match highlighting.
  131. *** ../vim-7.4.396/src/version.c    2014-08-06 18:17:03.475147780 +0200
  132. --- src/version.c    2014-08-06 19:06:44.627126354 +0200
  133. ***************
  134. *** 743,744 ****
  135. --- 743,746 ----
  136.   {   /* Add new patch number below this line */
  137. + /**/
  138. +     397,
  139.   /**/
  140.  
  141. -- 
  142. Often you're less important than your furniture.  If you think about it, you
  143. can get fired but your furniture stays behind, gainfully employed at the
  144. company that didn't need _you_ anymore.
  145.                 (Scott Adams - The Dilbert principle)
  146.  
  147.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  148. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  149. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  150.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  151.