Merge pull request #39 from wilywampa/blank_bugfix
Fix detection of re-indent setting and fix incorrect setline calls when re-indenting
This commit is contained in:
commit
0ae5d5ea99
@ -8,7 +8,8 @@ function! s:exchange(x, y, reverse, expand)
|
|||||||
let selection = &selection
|
let selection = &selection
|
||||||
set selection=inclusive
|
set selection=inclusive
|
||||||
|
|
||||||
let indent = s:get_setting('exchange_indent', 1) != 0 && a:x.type ==# 'V' && a:y.type ==# 'V'
|
" Compare using =~ because "'==' != 0" returns 0
|
||||||
|
let indent = s:get_setting('exchange_indent', 1) !~ 0 && a:x.type ==# 'V' && a:y.type ==# 'V'
|
||||||
|
|
||||||
if indent
|
if indent
|
||||||
let xindent = matchstr(getline(nextnonblank(a:y.start.line)), '^\s*')
|
let xindent = matchstr(getline(nextnonblank(a:y.start.line)), '^\s*')
|
||||||
@ -68,6 +69,9 @@ endfunction
|
|||||||
function! s:reindent(start, lines, new_indent)
|
function! s:reindent(start, lines, new_indent)
|
||||||
if s:get_setting('exchange_indent', 1) == '=='
|
if s:get_setting('exchange_indent', 1) == '=='
|
||||||
let lnum = nextnonblank(a:start)
|
let lnum = nextnonblank(a:start)
|
||||||
|
if lnum == 0 || lnum > a:start + a:lines - 1
|
||||||
|
return
|
||||||
|
endif
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
execute "silent normal! " . lnum . "G=="
|
execute "silent normal! " . lnum . "G=="
|
||||||
let new_indent = matchstr(getline(lnum), '^\s*')
|
let new_indent = matchstr(getline(lnum), '^\s*')
|
||||||
|
Loading…
Reference in New Issue
Block a user