allow to show the statusline on top

This is an experimental feature that allows to display the statusline in
the tabline. It might still be a bit rough, but seems to work so far.

Remaining problem:
- Mode changes are not immediately detected, only after moving the
  cursor

fixes #1388
closes #1867
This commit is contained in:
Christian Brabandt
2019-02-03 17:30:55 +01:00
parent 58bbc512f9
commit fd5bde1a3a
15 changed files with 94 additions and 33 deletions

View File

@@ -66,7 +66,7 @@ function! airline#extensions#hunks#get_hunks()
" Cache values, so that it isn't called too often
if exists("b:airline_hunks") &&
\ get(b:, 'airline_changenr', 0) == b:changedtick &&
\ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
\ airline#util#winwidth() == get(s:, 'airline_winwidth', 0) &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' &&
@@ -77,14 +77,14 @@ function! airline#extensions#hunks#get_hunks()
let string = ''
if !empty(hunks)
for i in [0, 1, 2]
if (s:non_zero_only == 0 && winwidth(0) > 100) || hunks[i] > 0
if (s:non_zero_only == 0 && airline#util#winwidth() > 100) || hunks[i] > 0
let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i])
endif
endfor
endif
let b:airline_hunks = string
let b:airline_changenr = b:changedtick
let s:airline_winwidth = winwidth(0)
let s:airline_winwidth = airline#util#winwidth()
return string
endfunction