Karsten Hopp d2f7b1
To: vim-dev@vim.org
Karsten Hopp d2f7b1
Subject: patch 7.1.048
Karsten Hopp d2f7b1
Fcc: outbox
Karsten Hopp d2f7b1
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d2f7b1
Mime-Version: 1.0
Karsten Hopp d2f7b1
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp d2f7b1
Content-Transfer-Encoding: 8bit
Karsten Hopp d2f7b1
------------
Karsten Hopp d2f7b1
Karsten Hopp d2f7b1
Patch 7.1.048
Karsten Hopp d2f7b1
Problem:    The matchparen plugin doesn't update the match when scrolling with
Karsten Hopp d2f7b1
	    the mouse wheel. (Ilya Bobir)
Karsten Hopp d2f7b1
Solution:   Set the match highlighting for text that can be scrolled into the
Karsten Hopp d2f7b1
	    viewable area without moving the cursor. (Chris Lubinski)
Karsten Hopp d2f7b1
Files:	    runtime/plugin/matchparen.vim
Karsten Hopp d2f7b1
Karsten Hopp d2f7b1
Karsten Hopp d2f7b1
*** ../vim-7.1.047/runtime/plugin/matchparen.vim	Sun May  6 14:26:16 2007
Karsten Hopp d2f7b1
--- runtime/plugin/matchparen.vim	Mon Jul 30 21:14:06 2007
Karsten Hopp d2f7b1
***************
Karsten Hopp d2f7b1
*** 1,6 ****
Karsten Hopp d2f7b1
  " Vim plugin for showing matching parens
Karsten Hopp d2f7b1
  " Maintainer:  Bram Moolenaar <Bram@vim.org>
Karsten Hopp d2f7b1
! " Last Change: 2006 Oct 12
Karsten Hopp d2f7b1
  
Karsten Hopp d2f7b1
  " Exit quickly when:
Karsten Hopp d2f7b1
  " - this plugin was already loaded (or disabled)
Karsten Hopp d2f7b1
--- 1,6 ----
Karsten Hopp d2f7b1
  " Vim plugin for showing matching parens
Karsten Hopp d2f7b1
  " Maintainer:  Bram Moolenaar <Bram@vim.org>
Karsten Hopp d2f7b1
! " Last Change: 2007 Jul 30
Karsten Hopp d2f7b1
  
Karsten Hopp d2f7b1
  " Exit quickly when:
Karsten Hopp d2f7b1
  " - this plugin was already loaded (or disabled)
Karsten Hopp d2f7b1
***************
Karsten Hopp d2f7b1
*** 62,86 ****
Karsten Hopp d2f7b1
    " Figure out the arguments for searchpairpos().
Karsten Hopp d2f7b1
    " Restrict the search to visible lines with "stopline".
Karsten Hopp d2f7b1
    " And avoid searching very far (e.g., for closed folds and long lines)
Karsten Hopp d2f7b1
    if i % 2 == 0
Karsten Hopp d2f7b1
      let s_flags = 'nW'
Karsten Hopp d2f7b1
      let c2 = plist[i + 1]
Karsten Hopp d2f7b1
      if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp d2f7b1
        let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
Karsten Hopp d2f7b1
!       let stopline = min([line('w$'), byte2line(stopbyte)])
Karsten Hopp d2f7b1
      else
Karsten Hopp d2f7b1
!       let stopline = min([line('w$'), c_lnum + 100])
Karsten Hopp d2f7b1
      endif
Karsten Hopp d2f7b1
    else
Karsten Hopp d2f7b1
      let s_flags = 'nbW'
Karsten Hopp d2f7b1
      let c2 = c
Karsten Hopp d2f7b1
      let c = plist[i - 1]
Karsten Hopp d2f7b1
      if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp d2f7b1
        let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
Karsten Hopp d2f7b1
!       let stopline = max([line('w0'), byte2line(stopbyte)])
Karsten Hopp d2f7b1
      else
Karsten Hopp d2f7b1
!       let stopline = max([line('w0'), c_lnum - 100])
Karsten Hopp d2f7b1
      endif
Karsten Hopp d2f7b1
    endif
Karsten Hopp d2f7b1
    if c == '['
Karsten Hopp d2f7b1
      let c = '\['
Karsten Hopp d2f7b1
--- 62,98 ----
Karsten Hopp d2f7b1
    " Figure out the arguments for searchpairpos().
Karsten Hopp d2f7b1
    " Restrict the search to visible lines with "stopline".
Karsten Hopp d2f7b1
    " And avoid searching very far (e.g., for closed folds and long lines)
Karsten Hopp d2f7b1
+   " The "viewable" variables give a range in which we can scroll while keeping
Karsten Hopp d2f7b1
+   " the cursor at the same position
Karsten Hopp d2f7b1
+   " adjustedScrolloff accounts for very large numbers of scrolloff
Karsten Hopp d2f7b1
+   let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
Karsten Hopp d2f7b1
+   let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
Karsten Hopp d2f7b1
+   let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
Karsten Hopp d2f7b1
+   " one of these stoplines will be adjusted below, but the current values are
Karsten Hopp d2f7b1
+   " minimal boundaries within the current window
Karsten Hopp d2f7b1
+   let stoplinebottom = line('w$')
Karsten Hopp d2f7b1
+   let stoplinetop = line('w0')
Karsten Hopp d2f7b1
    if i % 2 == 0
Karsten Hopp d2f7b1
      let s_flags = 'nW'
Karsten Hopp d2f7b1
      let c2 = plist[i + 1]
Karsten Hopp d2f7b1
      if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp d2f7b1
        let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
Karsten Hopp d2f7b1
!       let stopline = min([bottom_viewable, byte2line(stopbyte)])
Karsten Hopp d2f7b1
      else
Karsten Hopp d2f7b1
!       let stopline = min([bottom_viewable, c_lnum + 100])
Karsten Hopp d2f7b1
      endif
Karsten Hopp d2f7b1
+     let stoplinebottom = stopline
Karsten Hopp d2f7b1
    else
Karsten Hopp d2f7b1
      let s_flags = 'nbW'
Karsten Hopp d2f7b1
      let c2 = c
Karsten Hopp d2f7b1
      let c = plist[i - 1]
Karsten Hopp d2f7b1
      if has("byte_offset") && has("syntax_items") && &smc > 0
Karsten Hopp d2f7b1
        let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
Karsten Hopp d2f7b1
!       let stopline = max([top_viewable, byte2line(stopbyte)])
Karsten Hopp d2f7b1
      else
Karsten Hopp d2f7b1
!       let stopline = max([top_viewable, c_lnum - 100])
Karsten Hopp d2f7b1
      endif
Karsten Hopp d2f7b1
+     let stoplinetop = stopline
Karsten Hopp d2f7b1
    endif
Karsten Hopp d2f7b1
    if c == '['
Karsten Hopp d2f7b1
      let c = '\['
Karsten Hopp d2f7b1
***************
Karsten Hopp d2f7b1
*** 106,112 ****
Karsten Hopp d2f7b1
    endif
Karsten Hopp d2f7b1
  
Karsten Hopp d2f7b1
    " If a match is found setup match highlighting.
Karsten Hopp d2f7b1
!   if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')
Karsten Hopp d2f7b1
      exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) .
Karsten Hopp d2f7b1
  	  \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
Karsten Hopp d2f7b1
      let w:paren_hl_on = 1
Karsten Hopp d2f7b1
--- 118,124 ----
Karsten Hopp d2f7b1
    endif
Karsten Hopp d2f7b1
  
Karsten Hopp d2f7b1
    " If a match is found setup match highlighting.
Karsten Hopp d2f7b1
!   if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom 
Karsten Hopp d2f7b1
      exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) .
Karsten Hopp d2f7b1
  	  \ 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/'
Karsten Hopp d2f7b1
      let w:paren_hl_on = 1
Karsten Hopp d2f7b1
*** ../vim-7.1.047/src/version.c	Wed Aug  1 15:47:06 2007
Karsten Hopp d2f7b1
--- src/version.c	Thu Aug  2 22:59:07 2007
Karsten Hopp d2f7b1
***************
Karsten Hopp d2f7b1
*** 668,669 ****
Karsten Hopp d2f7b1
--- 668,671 ----
Karsten Hopp d2f7b1
  {   /* Add new patch number below this line */
Karsten Hopp d2f7b1
+ /**/
Karsten Hopp d2f7b1
+     48,
Karsten Hopp d2f7b1
  /**/
Karsten Hopp d2f7b1
Karsten Hopp d2f7b1
-- 
Karsten Hopp d2f7b1
hundred-and-one symptoms of being an internet addict:
Karsten Hopp d2f7b1
91. It's Saturday afternoon in the middle of May and you
Karsten Hopp d2f7b1
    are on computer.
Karsten Hopp d2f7b1
Karsten Hopp d2f7b1
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d2f7b1
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d2f7b1
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp d2f7b1
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///