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.1 / 7.1.269 < prev    next >
Encoding:
Internet Message Format  |  2008-03-08  |  6.0 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.1.269
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.1.269
  11. Problem:    The matchparen plugin has an arbitrary limit for the number of
  12.         lines to look for a match.
  13. Solution:   Rely on the searchpair() timeout.
  14. Files:        runtime/plugin/matchparen.vim
  15.  
  16.  
  17. *** ../vim-7.1.268/runtime/plugin/matchparen.vim    Sun Jan  6 20:05:36 2008
  18. --- runtime/plugin/matchparen.vim    Wed Feb 27 22:39:32 2008
  19. ***************
  20. *** 1,6 ****
  21.   " Vim plugin for showing matching parens
  22.   " Maintainer:  Bram Moolenaar <Bram@vim.org>
  23. ! " Last Change: 2008 Jan 06
  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: 2008 Feb 27
  31.   
  32.   " Exit quickly when:
  33.   " - this plugin was already loaded (or disabled)
  34. ***************
  35. *** 34,40 ****
  36.     endif
  37.   
  38.     " Avoid that we remove the popup menu.
  39. !   if pumvisible()
  40.       return
  41.     endif
  42.   
  43. --- 34,41 ----
  44.     endif
  45.   
  46.     " Avoid that we remove the popup menu.
  47. !   " Return when there are no colors (looks like the cursor jumps).
  48. !   if pumvisible() || (&t_Co < 8 && !has("gui_running"))
  49.       return
  50.     endif
  51.   
  52. ***************
  53. *** 60,98 ****
  54.     endif
  55.   
  56.     " Figure out the arguments for searchpairpos().
  57. -   " Restrict the search to visible lines with "stopline".
  58. -   " And avoid searching very far (e.g., for closed folds and long lines)
  59. -   " The "viewable" variables give a range in which we can scroll while keeping
  60. -   " the cursor at the same position
  61. -   " adjustedScrolloff accounts for very large numbers of scrolloff
  62. -   let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
  63. -   let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
  64. -   let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
  65. -   " one of these stoplines will be adjusted below, but the current values are
  66. -   " minimal boundaries within the current window
  67. -   let stoplinebottom = line('w$')
  68. -   let stoplinetop = line('w0')
  69.     if i % 2 == 0
  70.       let s_flags = 'nW'
  71.       let c2 = plist[i + 1]
  72. -     if has("byte_offset") && has("syntax_items") && &smc > 0
  73. -       let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
  74. -       let stopline = min([bottom_viewable, byte2line(stopbyte)])
  75. -     else
  76. -       let stopline = min([bottom_viewable, c_lnum + 100])
  77. -     endif
  78. -     let stoplinebottom = stopline
  79.     else
  80.       let s_flags = 'nbW'
  81.       let c2 = c
  82.       let c = plist[i - 1]
  83. -     if has("byte_offset") && has("syntax_items") && &smc > 0
  84. -       let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
  85. -       let stopline = max([top_viewable, byte2line(stopbyte)])
  86. -     else
  87. -       let stopline = max([top_viewable, c_lnum - 100])
  88. -     endif
  89. -     let stoplinetop = stopline
  90.     endif
  91.     if c == '['
  92.       let c = '\['
  93. --- 61,73 ----
  94. ***************
  95. *** 111,120 ****
  96.       \ '=~?  "string\\|character\\|singlequote\\|comment"'
  97.     execute 'if' s_skip '| let s_skip = 0 | endif'
  98.   
  99.     try
  100. !     " Limit the search time to 500 msec to avoid a hang on very long lines.
  101. !     let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 500)
  102.     catch /E118/
  103.       let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
  104.     endtry
  105.   
  106. --- 86,132 ----
  107.       \ '=~?  "string\\|character\\|singlequote\\|comment"'
  108.     execute 'if' s_skip '| let s_skip = 0 | endif'
  109.   
  110. +   " Limit the search to lines visible in the window.
  111. +   let stoplinebottom = line('w$')
  112. +   let stoplinetop = line('w0')
  113. +   if i % 2 == 0
  114. +     let stopline = stoplinebottom
  115. +   else
  116. +     let stopline = stoplinetop
  117. +   endif
  118.     try
  119. !     " Limit the search time to 300 msec to avoid a hang on very long lines.
  120. !     " This fails when a timeout is not supported.
  121. !     let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 300)
  122.     catch /E118/
  123. +     " Can't use the timeout, restrict the stopline a bit more to avoid taking
  124. +     " a long time on closed folds and long lines.
  125. +     " The "viewable" variables give a range in which we can scroll while
  126. +     " keeping the cursor at the same position.
  127. +     " adjustedScrolloff accounts for very large numbers of scrolloff.
  128. +     let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
  129. +     let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
  130. +     let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
  131. +     " one of these stoplines will be adjusted below, but the current values are
  132. +     " minimal boundaries within the current window
  133. +     if i % 2 == 0
  134. +       if has("byte_offset") && has("syntax_items") && &smc > 0
  135. +     let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
  136. +     let stopline = min([bottom_viewable, byte2line(stopbyte)])
  137. +       else
  138. +     let stopline = min([bottom_viewable, c_lnum + 100])
  139. +       endif
  140. +       let stoplinebottom = stopline
  141. +     else
  142. +       if has("byte_offset") && has("syntax_items") && &smc > 0
  143. +     let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
  144. +     let stopline = max([top_viewable, byte2line(stopbyte)])
  145. +       else
  146. +     let stopline = max([top_viewable, c_lnum - 100])
  147. +       endif
  148. +       let stoplinetop = stopline
  149. +     endif
  150.       let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
  151.     endtry
  152.   
  153. *** ../vim-7.1.268/src/version.c    Sun Mar  9 14:30:12 2008
  154. --- src/version.c    Sun Mar  9 16:21:00 2008
  155. ***************
  156. *** 668,669 ****
  157. --- 668,671 ----
  158.   {   /* Add new patch number below this line */
  159. + /**/
  160. +     269,
  161.   /**/
  162.  
  163. -- 
  164. hundred-and-one symptoms of being an internet addict:
  165. 93. New mail alarm on your palmtop annoys other churchgoers.
  166.  
  167.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  168. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  169. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  170.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  171.