don't add a second separator if not needed

Using let g:airline_section_y = airline#section#create_right(['ffenc','%{strftime("%H:%M")}'])
will result in an output string of `utf-8[unix] < < 00:00`

This happens, because the function util#prepend() will eventually add an
extra separator, if the width is zero. Therefore, when building the
string, remember, if the last section added an extra separator and only
add one, if there hasn't been added one before.

fixes #1220
This commit is contained in:
Christian Brabandt
2016-08-01 21:00:47 +02:00
parent 54e4772ef8
commit c0cb03f48b
2 changed files with 16 additions and 1 deletions

View File

@@ -72,5 +72,10 @@ describe 'section'
let s = airline#section#create(['conditional'])
Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}'
end
it 'should not draw two separators after another'
let s = airline#section#create_right(['ffenc','%{strftime("%H:%M")}'])
Expect s == '%{airline#util#prepend(airline#parts#ffenc(),0)}%{strftime("%H:%M")}'
end
end