Let off-screen matching work at screen edge, closes #28

This commit is contained in:
Andy K. Massimino
2018-04-18 11:34:46 -04:00
parent 633fd624cd
commit 57fc88cd68
3 changed files with 13 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ function! s:init_options()
call s:init_option('matchup_matchparen_enabled',
\ !(&t_Co < 8 && !has('gui_running')))
call s:init_option('matchup_matchparen_status_offscreen', 1)
call s:init_option('matchup_matchparen_scrolloff', 0)
call s:init_option('matchup_matchparen_singleton', 0)
call s:init_option('matchup_matchparen_deferred', 0)
call s:init_option('matchup_matchparen_deferred_show_delay', 50)

View File

@@ -299,13 +299,14 @@ function! s:matchparen.highlight(...) abort dict " {{{1
let w:matchup_need_clear = 1
" disable off-screen when scrolling with j/k
let l:scrolling = winheight(0) > 2*&scrolloff
let l:scrolling = g:matchup_matchparen_scrolloff
\ && winheight(0) > 2*&scrolloff
\ && (line('.') == line('w$')-&scrolloff
\ || line('.') == line('w0')+&scrolloff)
" show off-screen matches
if g:matchup_matchparen_status_offscreen && !l:current.skip
\ && (!l:scrolling || g:matchup_matchparen_deferred)
if g:matchup_matchparen_status_offscreen
\ && !l:current.skip && !l:scrolling
call matchup#matchparen#offscreen(l:current)
endif

View File

@@ -538,6 +538,14 @@ Module matchparen~
Default: 1
*g:matchup_matchparen_scrolloff*
When enabled, off-screen matches will not be shown in the statusline
while the cursor is at the screen edge (respects the value of 'scrolloff').
This is intended to prevent flickering while scrolling with j and k.
Default: 0
*g:matchup_matchparen_stopline*
The number of lines to search in either direction while highlighting