When cacheing the values of buffer number, window number per tabpage, we
might forget to update the statusline when it is actually needed, e.g.
on `:tab help h | norm! gt` which would then still display "Help" also
we are not in a help window anymore.
Therefore cache those values (including current tabpage number)
globally.
fixes#1253
consider a window with these splits:
,----
| file1
| ---
| file2
| ---
| file1
`----
If the top buffer is the active one and you start modifying this buffer,
this will also reset the highlighting for the inactive buffer2, since
the highlighting group 'airline_c_inactive' is used for both windows
(one having the unmodified buffer 'file2' and one having the modified
'file1').
This lead to the incorrect highlighting of the buffer name of file2.
Airline basically already created different airline_c<bufnr>_inactive
highlighting groups, but unfortunately did not use them.
Therefore, make the builder aware of this and always append the buffer
number to the group 'airline_c' if it is in an inactive window.
2) we need to make sure, the highlighting won't get overwritten, so
make the highlighter aware of this situation as well, by appending the
buffer number to the group name, if it creates the 'inactive' mode
groups and a buffer number has been given.
this fixes#1233
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
If active buffer is modified, `:AirlineRefresh` apply `normal` highlight
instead of `normal_modified` highlight.
No particular config is requiered to reproduce this bug.
I see this bug with option `g:airline_skip_empty_sections` set.
Add any modification at the active buffer return to normal mode,
**do not save** and wait a few seconds, you can see highlight change to
normal but file is modified.
Without option `g:airline_skip_empty_sections`, add any modification at
the active buffer return to normal mode and type `:AirlineRefresh` you
can see change to bad highlight .
The syntastic plugin recommends to adjust the statusline.
This does not apply for vim-airline for obvious reasons. Therefore
mention that this recommendation does not apply for us.
Cache the hunk values. In case of short windows, shorten the hunk string
a little bit and make the branch extension take the hunk value into
account when deciding how much to shorten it.
Sometimes, if a buffer triggers many whitespace check warnings,
and the Vim window size is too small, other parts of the statusline
might become unreadable.
Therefore, if the window size is smaller than say 120 characters
and the whitespace warning > 9 chars, limit it to 10 characters
and inidicate, that there is more to come