]>
Commit | Line | Data |
---|---|---|
6577e359 | 1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.048 | |
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.048 | |
11 | Problem: The matchparen plugin doesn't update the match when scrolling with | |
12 | the mouse wheel. (Ilya Bobir) | |
13 | Solution: Set the match highlighting for text that can be scrolled into the | |
14 | viewable area without moving the cursor. (Chris Lubinski) | |
15 | Files: runtime/plugin/matchparen.vim | |
16 | ||
17 | ||
18 | *** ../vim-7.1.047/runtime/plugin/matchparen.vim Sun May 6 14:26:16 2007 | |
19 | --- runtime/plugin/matchparen.vim Mon Jul 30 21:14:06 2007 | |
20 | *************** | |
21 | *** 1,6 **** | |
22 | " Vim plugin for showing matching parens | |
23 | " Maintainer: Bram Moolenaar <Bram@vim.org> | |
24 | ! " Last Change: 2006 Oct 12 | |
25 | ||
26 | " Exit quickly when: | |
27 | " - this plugin was already loaded (or disabled) | |
28 | --- 1,6 ---- | |
29 | " Vim plugin for showing matching parens | |
30 | " Maintainer: Bram Moolenaar <Bram@vim.org> | |
31 | ! " Last Change: 2007 Jul 30 | |
32 | ||
33 | " Exit quickly when: | |
34 | " - this plugin was already loaded (or disabled) | |
35 | *************** | |
36 | *** 62,86 **** | |
37 | " Figure out the arguments for searchpairpos(). | |
38 | " Restrict the search to visible lines with "stopline". | |
39 | " And avoid searching very far (e.g., for closed folds and long lines) | |
40 | if i % 2 == 0 | |
41 | let s_flags = 'nW' | |
42 | let c2 = plist[i + 1] | |
43 | if has("byte_offset") && has("syntax_items") && &smc > 0 | |
44 | let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) | |
45 | ! let stopline = min([line('w$'), byte2line(stopbyte)]) | |
46 | else | |
47 | ! let stopline = min([line('w$'), c_lnum + 100]) | |
48 | endif | |
49 | else | |
50 | let s_flags = 'nbW' | |
51 | let c2 = c | |
52 | let c = plist[i - 1] | |
53 | if has("byte_offset") && has("syntax_items") && &smc > 0 | |
54 | let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) | |
55 | ! let stopline = max([line('w0'), byte2line(stopbyte)]) | |
56 | else | |
57 | ! let stopline = max([line('w0'), c_lnum - 100]) | |
58 | endif | |
59 | endif | |
60 | if c == '[' | |
61 | let c = '\[' | |
62 | --- 62,98 ---- | |
63 | " Figure out the arguments for searchpairpos(). | |
64 | " Restrict the search to visible lines with "stopline". | |
65 | " And avoid searching very far (e.g., for closed folds and long lines) | |
66 | + " The "viewable" variables give a range in which we can scroll while keeping | |
67 | + " the cursor at the same position | |
68 | + " adjustedScrolloff accounts for very large numbers of scrolloff | |
69 | + let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) | |
70 | + let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) | |
71 | + let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) | |
72 | + " one of these stoplines will be adjusted below, but the current values are | |
73 | + " minimal boundaries within the current window | |
74 | + let stoplinebottom = line('w$') | |
75 | + let stoplinetop = line('w0') | |
76 | if i % 2 == 0 | |
77 | let s_flags = 'nW' | |
78 | let c2 = plist[i + 1] | |
79 | if has("byte_offset") && has("syntax_items") && &smc > 0 | |
80 | let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) | |
81 | ! let stopline = min([bottom_viewable, byte2line(stopbyte)]) | |
82 | else | |
83 | ! let stopline = min([bottom_viewable, c_lnum + 100]) | |
84 | endif | |
85 | + let stoplinebottom = stopline | |
86 | else | |
87 | let s_flags = 'nbW' | |
88 | let c2 = c | |
89 | let c = plist[i - 1] | |
90 | if has("byte_offset") && has("syntax_items") && &smc > 0 | |
91 | let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) | |
92 | ! let stopline = max([top_viewable, byte2line(stopbyte)]) | |
93 | else | |
94 | ! let stopline = max([top_viewable, c_lnum - 100]) | |
95 | endif | |
96 | + let stoplinetop = stopline | |
97 | endif | |
98 | if c == '[' | |
99 | let c = '\[' | |
100 | *************** | |
101 | *** 106,112 **** | |
102 | endif | |
103 | ||
104 | " If a match is found setup match highlighting. | |
105 | ! if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$') | |
106 | exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . | |
107 | \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' | |
108 | let w:paren_hl_on = 1 | |
109 | --- 118,124 ---- | |
110 | endif | |
111 | ||
112 | " If a match is found setup match highlighting. | |
113 | ! if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom | |
114 | exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . | |
115 | \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' | |
116 | let w:paren_hl_on = 1 | |
117 | *** ../vim-7.1.047/src/version.c Wed Aug 1 15:47:06 2007 | |
118 | --- src/version.c Thu Aug 2 22:59:07 2007 | |
119 | *************** | |
120 | *** 668,669 **** | |
121 | --- 668,671 ---- | |
122 | { /* Add new patch number below this line */ | |
123 | + /**/ | |
124 | + 48, | |
125 | /**/ | |
126 | ||
127 | -- | |
128 | hundred-and-one symptoms of being an internet addict: | |
129 | 91. It's Saturday afternoon in the middle of May and you | |
130 | are on computer. | |
131 | ||
132 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
133 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
134 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
135 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |