Exclude whitespace-only lines from Limelight range

This commit is contained in:
Pierre Douyon
2015-07-26 17:38:43 -04:00
parent dbe351f683
commit df66855282

View File

@@ -43,19 +43,23 @@ function! s:unsupported()
endfunction endfunction
function! s:getpos() function! s:getpos()
let span = max([0, get(g:, 'limelight_paragraph_span', 0) - empty(getline('.'))]) let span = max([0, get(g:, 'limelight_paragraph_span', 0) - s:empty(getline('.'))])
let pos = getpos('.') let pos = getpos('.')
for _ in range(0, span) for _ in range(0, span)
let start = searchpos('^$', 'bW')[0] let start = searchpos('^\s*$', 'bW')[0]
endfor endfor
call setpos('.', pos) call setpos('.', pos)
for _ in range(0, span) for _ in range(0, span)
let end = searchpos('^$', 'W')[0] let end = searchpos('^\s*$', 'W')[0]
endfor endfor
call setpos('.', pos) call setpos('.', pos)
return [start, end] return [start, end]
endfunction endfunction
function! s:empty(line)
return (a:line =~# '^\s*$')
endfunction
function! s:limelight() function! s:limelight()
if !empty(get(w:, 'limelight_range', [])) if !empty(get(w:, 'limelight_range', []))
return return