Revert "Alternate strategy for empty first column"
Per tpope:
"I just discovered the second of the two tabular fixes I gave you
doesn't work properly if the delimiter is at the very beginning of the
line... [It] pretended the leading whitespace was part of the padding,
which doesn't help if there's no leading whitespace."
This reverts commit 16f7b1e204
.
This commit is contained in:
parent
16f7b1e204
commit
f4d460ea92
@ -184,9 +184,7 @@ function! tabular#TabularizeStrings(strings, delim, ...)
|
|||||||
" intentionally
|
" intentionally
|
||||||
" - Don't strip leading spaces from the first element; we like indenting.
|
" - Don't strip leading spaces from the first element; we like indenting.
|
||||||
for line in lines
|
for line in lines
|
||||||
if line[0] =~ '^\s*$'
|
if line[0] !~ '^\s*$'
|
||||||
let line[0] = line[0][format[0][1:-1] : -1]
|
|
||||||
else
|
|
||||||
let line[0] = s:StripTrailingSpaces(line[0])
|
let line[0] = s:StripTrailingSpaces(line[0])
|
||||||
endif
|
endif
|
||||||
if len(line) >= 3
|
if len(line) >= 3
|
||||||
@ -208,6 +206,8 @@ function! tabular#TabularizeStrings(strings, delim, ...)
|
|||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
let lead_blank = empty(filter(copy(lines), 'v:val[0] =~ "\\S"'))
|
||||||
|
|
||||||
" Concatenate the fields, according to the format pattern.
|
" Concatenate the fields, according to the format pattern.
|
||||||
for idx in range(len(lines))
|
for idx in range(len(lines))
|
||||||
let line = lines[idx]
|
let line = lines[idx]
|
||||||
@ -223,7 +223,7 @@ function! tabular#TabularizeStrings(strings, delim, ...)
|
|||||||
let field = s:Center(line[i], maxes[i])
|
let field = s:Center(line[i], maxes[i])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let line[i] = field . repeat(" ", pad)
|
let line[i] = field . (lead_blank && i == 0 ? '' : repeat(" ", pad))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let lines[idx] = s:StripTrailingSpaces(join(line, ''))
|
let lines[idx] = s:StripTrailingSpaces(join(line, ''))
|
||||||
|
Loading…
Reference in New Issue
Block a user