Fix blank lines issue

In #254, probably because the tag is followed by <CR>, cstta<CR> sets
regtype 'V'(linewise) though its keeper doesn't end with <CR>.  And
setreg() adds extra <CR> at @".  Remove this extra <CR> and fix adding
<CR> method.
This commit is contained in:
matsuhav 2018-07-24 03:52:25 +09:00 committed by Tim Pope
parent aa1f120ad3
commit 597068870b

View File

@ -263,11 +263,16 @@ function! s:wrap(string,char,type,removed,special)
elseif keeper =~ '\n$' && after =~ '^\n' elseif keeper =~ '\n$' && after =~ '^\n'
let after = strpart(after,1) let after = strpart(after,1)
endif endif
if before !~ '\n\s*$' if keeper !~ '^\n' && before !~ '\n\s*$'
let before .= "\n" let before .= "\n"
if a:special if a:special
let before .= "\t" let before .= "\t"
endif endif
elseif keeper =~ '^\n' && before =~ '\n\s*$'
let keeper = strcharpart(keeper,1)
endif
if type ==# 'V' && keeper =~ '\n\s*\n$'
let keeper = strcharpart(keeper,0,strchars(keeper) - 1)
endif endif
endif endif
if type ==# 'V' if type ==# 'V'