mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-06 12:14:24 +08:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user