]>
Commit | Line | Data |
---|---|---|
ef75664d AG |
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 | + | |
119 | try | |
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) | |
123 | catch /E118/ | |
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 | |
134 | + if i % 2 == 0 | |
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)]) | |
138 | + else | |
139 | + let stopline = min([bottom_viewable, c_lnum + 100]) | |
140 | + endif | |
141 | + let stoplinebottom = stopline | |
142 | + else | |
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)]) | |
146 | + else | |
147 | + let stopline = max([top_viewable, c_lnum - 100]) | |
148 | + endif | |
149 | + let stoplinetop = stopline | |
150 | + endif | |
151 | let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) | |
152 | endtry | |
153 | ||
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 | |
156 | *************** | |
157 | *** 668,669 **** | |
158 | --- 668,671 ---- | |
159 | { /* Add new patch number below this line */ | |
160 | + /**/ | |
161 | + 269, | |
162 | /**/ | |
163 | ||
164 | -- | |
165 | hundred-and-one symptoms of being an internet addict: | |
166 | 93. New mail alarm on your palmtop annoys other churchgoers. | |
167 | ||
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 /// |