Fix whitespace symbol empty string has extra space

This makes it so if the whitespace symbol (g:airline#extensions#whitespace#symbol) is an empty string, we don't end up wth two characters at the beginning of the message.
This commit is contained in:
Benjamin Thomas 2016-10-02 01:22:50 -07:00 committed by GitHub
parent 2be9a044e0
commit 78439b2b35
1 changed files with 10 additions and 4 deletions

View File

@ -92,18 +92,24 @@ function! airline#extensions#whitespace#check()
if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file)
let b:airline_whitespace_check = s:symbol
if strlen(s:symbol) > 0
let space = (g:airline_symbols.space)
else
let space = ''
endif
if s:show_message
if trailing != 0
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing)
let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing)
endif
if mixed != 0
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed)
let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed)
endif
if long != 0
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:long_format, long)
let b:airline_whitespace_check .= space.printf(s:long_format, long)
endif
if !empty(mixed_file)
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_file_format, mixed_file)
let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file)
endif
endif
endif