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 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
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
22 " Vim plugin for showing matching parens
23 " Maintainer: Bram Moolenaar <Bram@vim.org>
24 ! " Last Change: 2006 Oct 12
27 " - this plugin was already loaded (or disabled)
29 " Vim plugin for showing matching parens
30 " Maintainer: Bram Moolenaar <Bram@vim.org>
31 ! " Last Change: 2007 Jul 30
34 " - this plugin was already loaded (or disabled)
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)
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)])
47 ! let stopline = min([line('w$'), c_lnum + 100])
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)])
57 ! let stopline = max([line('w0'), c_lnum - 100])
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')
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)])
83 ! let stopline = min([bottom_viewable, c_lnum + 100])
85 + let stoplinebottom = stopline
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)])
94 ! let stopline = max([top_viewable, c_lnum - 100])
96 + let stoplinetop = stopline
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
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
122 { /* Add new patch number below this line */
128 hundred-and-one symptoms of being an internet addict:
129 91. It's Saturday afternoon in the middle of May and you
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 ///