4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
21 " Vim plugin for showing matching parens
22 " Maintainer: Bram Moolenaar <Bram@vim.org>
23 ! " Last Change: 2008 Jan 06
26 " - this plugin was already loaded (or disabled)
28 " Vim plugin for showing matching parens
29 " Maintainer: Bram Moolenaar <Bram@vim.org>
30 ! " Last Change: 2008 Feb 27
33 " - this plugin was already loaded (or disabled)
38 " Avoid that we remove the popup menu.
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"))
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')
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)])
76 - let stopline = min([bottom_viewable, c_lnum + 100])
78 - let stoplinebottom = stopline
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)])
87 - let stopline = max([top_viewable, c_lnum - 100])
89 - let stoplinetop = stopline
96 \ '=~? "string\\|character\\|singlequote\\|comment"'
97 execute 'if' s_skip '| let s_skip = 0 | endif'
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)
103 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
107 \ '=~? "string\\|character\\|singlequote\\|comment"'
108 execute 'if' s_skip '| let s_skip = 0 | endif'
110 + " Limit the search to lines visible in the window.
111 + let stoplinebottom = line('w$')
112 + let stoplinetop = line('w0')
114 + let stopline = stoplinebottom
116 + let stopline = stoplinetop
120 ! " Limit the search time to 300 msec to avoid a hang on very long lines.
121 ! " This fails when a timeout is not supported.
122 ! let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 300)
124 + " Can't use the timeout, restrict the stopline a bit more to avoid taking
125 + " a long time on closed folds and long lines.
126 + " The "viewable" variables give a range in which we can scroll while
127 + " keeping the cursor at the same position.
128 + " adjustedScrolloff accounts for very large numbers of scrolloff.
129 + let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
130 + let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
131 + let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
132 + " one of these stoplines will be adjusted below, but the current values are
133 + " minimal boundaries within the current window
135 + if has("byte_offset") && has("syntax_items") && &smc > 0
136 + let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
137 + let stopline = min([bottom_viewable, byte2line(stopbyte)])
139 + let stopline = min([bottom_viewable, c_lnum + 100])
141 + let stoplinebottom = stopline
143 + if has("byte_offset") && has("syntax_items") && &smc > 0
144 + let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
145 + let stopline = max([top_viewable, byte2line(stopbyte)])
147 + let stopline = max([top_viewable, c_lnum - 100])
149 + let stoplinetop = stopline
151 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
154 *** ../vim-7.1.268/src/version.c Sun Mar 9 14:30:12 2008
155 --- src/version.c Sun Mar 9 16:21:00 2008
159 { /* Add new patch number below this line */
165 hundred-and-one symptoms of being an internet addict:
166 93. New mail alarm on your palmtop annoys other churchgoers.
168 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
169 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
170 \\\ download, build and distribute -- http://www.A-A-P.org ///
171 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///