Make sure we don't remove all leading indent

The 'remove trailing spaces from first field' logic backfired if the
first field was all whitespace.
This commit is contained in:
Matt Wozniski 2009-03-09 17:23:26 -04:00
parent f9f6d5bf15
commit ae157f4a06

View File

@ -184,7 +184,9 @@ function! tabular#TabularizeStrings(strings, delim, ...)
" intentionally
" - Don't strip leading spaces from the first element; we like indenting.
for line in lines
let line[0] = s:StripTrailingSpaces(line[0])
if line[0] !~ '^\s*$'
let line[0] = s:StripTrailingSpaces(line[0])
endif
if len(line) >= 3
for i in range(2, len(line)-1, 2)
let line[i] = s:StripLeadingSpaces(s:StripTrailingSpaces(line[i]))