Karsten Hopp cc1a1d
To: vim-dev@vim.org
Karsten Hopp cc1a1d
Subject: Patch 7.1.269
Karsten Hopp cc1a1d
Fcc: outbox
Karsten Hopp cc1a1d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp cc1a1d
Mime-Version: 1.0
Karsten Hopp cc1a1d
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp cc1a1d
Content-Transfer-Encoding: 8bit
Karsten Hopp cc1a1d
------------
Karsten Hopp cc1a1d
Karsten Hopp cc1a1d
Patch 7.1.269
Karsten Hopp cc1a1d
Problem:    The matchparen plugin has an arbitrary limit for the number of
Karsten Hopp cc1a1d
	    lines to look for a match.
Karsten Hopp cc1a1d
Solution:   Rely on the searchpair() timeout.
Karsten Hopp cc1a1d
Files:	    runtime/plugin/matchparen.vim
Karsten Hopp cc1a1d
Karsten Hopp cc1a1d
Karsten Hopp cc1a1d
*** ../vim-7.1.268/runtime/plugin/matchparen.vim	Sun Jan  6 20:05:36 2008
Karsten Hopp cc1a1d
--- runtime/plugin/matchparen.vim	Wed Feb 27 22:39:32 2008
Karsten Hopp cc1a1d
***************
Karsten Hopp cc1a1d
*** 1,6 ****
Karsten Hopp cc1a1d
  " Vim plugin for showing matching parens
Karsten Hopp cc1a1d
  " Maintainer:  Bram Moolenaar <Bram@vim.org>
Karsten Hopp cc1a1d
! " Last Change: 2008 Jan 06
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
  " Exit quickly when:
Karsten Hopp cc1a1d
  " - this plugin was already loaded (or disabled)
Karsten Hopp cc1a1d
--- 1,6 ----
Karsten Hopp cc1a1d
  " Vim plugin for showing matching parens
Karsten Hopp cc1a1d
  " Maintainer:  Bram Moolenaar <Bram@vim.org>
Karsten Hopp cc1a1d
! " Last Change: 2008 Feb 27
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
  " Exit quickly when:
Karsten Hopp cc1a1d
  " - this plugin was already loaded (or disabled)
Karsten Hopp cc1a1d
***************
Karsten Hopp cc1a1d
*** 34,40 ****
Karsten Hopp cc1a1d
    endif
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
    " Avoid that we remove the popup menu.
Karsten Hopp cc1a1d
!   if pumvisible()
Karsten Hopp cc1a1d
      return
Karsten Hopp cc1a1d
    endif
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
--- 34,41 ----
Karsten Hopp cc1a1d
    endif
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
    " Avoid that we remove the popup menu.
Karsten Hopp cc1a1d
!   " Return when there are no colors (looks like the cursor jumps).
Karsten Hopp cc1a1d
!   if pumvisible() || (&t_Co < 8 && !has("gui_running"))
Karsten Hopp cc1a1d
      return
Karsten Hopp cc1a1d
    endif
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
***************
Karsten Hopp cc1a1d
*** 60,98 ****
Karsten Hopp cc1a1d
    endif
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
    " Figure out the arguments for searchpairpos().
Karsten Hopp cc1a1d
-   " Restrict the search to visible lines with "stopline".
Karsten Hopp cc1a1d
-   " And avoid searching very far (e.g., for closed folds and long lines)
Karsten Hopp cc1a1d
-   " The "viewable" variables give a range in which we can scroll while keeping
Karsten Hopp cc1a1d
-   " the cursor at the same position
Karsten Hopp cc1a1d
-   " adjustedScrolloff accounts for very large numbers of scrolloff
Karsten Hopp cc1a1d
-   let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
Karsten Hopp cc1a1d
-   let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
Karsten Hopp cc1a1d
-   let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
Karsten Hopp cc1a1d
-   " one of these stoplines will be adjusted below, but the current values are
Karsten Hopp cc1a1d
-   " minimal boundaries within the current window
Karsten Hopp cc1a1d
-   let stoplinebottom = line('w$')
Karsten Hopp cc1a1d
-   let stoplinetop = line('w0')
Karsten Hopp cc1a1d
    if i % 2 == 0
Karsten Hopp cc1a1d
      let s_flags = 'nW'
Karsten Hopp cc1a1d
      let c2 = plist[i + 1]
Karsten Hopp cc1a1d
-     if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp cc1a1d
-       let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
Karsten Hopp cc1a1d
-       let stopline = min([bottom_viewable, byte2line(stopbyte)])
Karsten Hopp cc1a1d
-     else
Karsten Hopp cc1a1d
-       let stopline = min([bottom_viewable, c_lnum + 100])
Karsten Hopp cc1a1d
-     endif
Karsten Hopp cc1a1d
-     let stoplinebottom = stopline
Karsten Hopp cc1a1d
    else
Karsten Hopp cc1a1d
      let s_flags = 'nbW'
Karsten Hopp cc1a1d
      let c2 = c
Karsten Hopp cc1a1d
      let c = plist[i - 1]
Karsten Hopp cc1a1d
-     if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp cc1a1d
-       let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
Karsten Hopp cc1a1d
-       let stopline = max([top_viewable, byte2line(stopbyte)])
Karsten Hopp cc1a1d
-     else
Karsten Hopp cc1a1d
-       let stopline = max([top_viewable, c_lnum - 100])
Karsten Hopp cc1a1d
-     endif
Karsten Hopp cc1a1d
-     let stoplinetop = stopline
Karsten Hopp cc1a1d
    endif
Karsten Hopp cc1a1d
    if c == '['
Karsten Hopp cc1a1d
      let c = '\['
Karsten Hopp cc1a1d
--- 61,73 ----
Karsten Hopp cc1a1d
***************
Karsten Hopp cc1a1d
*** 111,120 ****
Karsten Hopp cc1a1d
  	\ '=~?  "string\\|character\\|singlequote\\|comment"'
Karsten Hopp cc1a1d
    execute 'if' s_skip '| let s_skip = 0 | endif'
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
    try
Karsten Hopp cc1a1d
!     " Limit the search time to 500 msec to avoid a hang on very long lines.
Karsten Hopp cc1a1d
!     let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 500)
Karsten Hopp cc1a1d
    catch /E118/
Karsten Hopp cc1a1d
      let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
Karsten Hopp cc1a1d
    endtry
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
--- 86,132 ----
Karsten Hopp cc1a1d
  	\ '=~?  "string\\|character\\|singlequote\\|comment"'
Karsten Hopp cc1a1d
    execute 'if' s_skip '| let s_skip = 0 | endif'
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
+   " Limit the search to lines visible in the window.
Karsten Hopp cc1a1d
+   let stoplinebottom = line('w$')
Karsten Hopp cc1a1d
+   let stoplinetop = line('w0')
Karsten Hopp cc1a1d
+   if i % 2 == 0
Karsten Hopp cc1a1d
+     let stopline = stoplinebottom
Karsten Hopp cc1a1d
+   else
Karsten Hopp cc1a1d
+     let stopline = stoplinetop
Karsten Hopp cc1a1d
+   endif
Karsten Hopp cc1a1d
+ 
Karsten Hopp cc1a1d
    try
Karsten Hopp cc1a1d
!     " Limit the search time to 300 msec to avoid a hang on very long lines.
Karsten Hopp cc1a1d
!     " This fails when a timeout is not supported.
Karsten Hopp cc1a1d
!     let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 300)
Karsten Hopp cc1a1d
    catch /E118/
Karsten Hopp cc1a1d
+     " Can't use the timeout, restrict the stopline a bit more to avoid taking
Karsten Hopp cc1a1d
+     " a long time on closed folds and long lines.
Karsten Hopp cc1a1d
+     " The "viewable" variables give a range in which we can scroll while
Karsten Hopp cc1a1d
+     " keeping the cursor at the same position.
Karsten Hopp cc1a1d
+     " adjustedScrolloff accounts for very large numbers of scrolloff.
Karsten Hopp cc1a1d
+     let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
Karsten Hopp cc1a1d
+     let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
Karsten Hopp cc1a1d
+     let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
Karsten Hopp cc1a1d
+     " one of these stoplines will be adjusted below, but the current values are
Karsten Hopp cc1a1d
+     " minimal boundaries within the current window
Karsten Hopp cc1a1d
+     if i % 2 == 0
Karsten Hopp cc1a1d
+       if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp cc1a1d
+ 	let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
Karsten Hopp cc1a1d
+ 	let stopline = min([bottom_viewable, byte2line(stopbyte)])
Karsten Hopp cc1a1d
+       else
Karsten Hopp cc1a1d
+ 	let stopline = min([bottom_viewable, c_lnum + 100])
Karsten Hopp cc1a1d
+       endif
Karsten Hopp cc1a1d
+       let stoplinebottom = stopline
Karsten Hopp cc1a1d
+     else
Karsten Hopp cc1a1d
+       if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp cc1a1d
+ 	let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
Karsten Hopp cc1a1d
+ 	let stopline = max([top_viewable, byte2line(stopbyte)])
Karsten Hopp cc1a1d
+       else
Karsten Hopp cc1a1d
+ 	let stopline = max([top_viewable, c_lnum - 100])
Karsten Hopp cc1a1d
+       endif
Karsten Hopp cc1a1d
+       let stoplinetop = stopline
Karsten Hopp cc1a1d
+     endif
Karsten Hopp cc1a1d
      let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
Karsten Hopp cc1a1d
    endtry
Karsten Hopp cc1a1d
  
Karsten Hopp cc1a1d
*** ../vim-7.1.268/src/version.c	Sun Mar  9 14:30:12 2008
Karsten Hopp cc1a1d
--- src/version.c	Sun Mar  9 16:21:00 2008
Karsten Hopp cc1a1d
***************
Karsten Hopp cc1a1d
*** 668,669 ****
Karsten Hopp cc1a1d
--- 668,671 ----
Karsten Hopp cc1a1d
  {   /* Add new patch number below this line */
Karsten Hopp cc1a1d
+ /**/
Karsten Hopp cc1a1d
+     269,
Karsten Hopp cc1a1d
  /**/
Karsten Hopp cc1a1d
Karsten Hopp cc1a1d
-- 
Karsten Hopp cc1a1d
hundred-and-one symptoms of being an internet addict:
Karsten Hopp cc1a1d
93. New mail alarm on your palmtop annoys other churchgoers.
Karsten Hopp cc1a1d
Karsten Hopp cc1a1d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp cc1a1d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp cc1a1d
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp cc1a1d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///