mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-23 08:28:50 +08:00
Don't change remaining_space in tabline builder until necessary
This commit is contained in:
parent
4b1913ad13
commit
c75106f12d
|
@ -40,8 +40,8 @@ endfunction
|
||||||
" object, if the title is inserted.
|
" object, if the title is inserted.
|
||||||
function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict
|
function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict
|
||||||
let title = self.get_title(a:index)
|
let title = self.get_title(a:index)
|
||||||
let self._remaining_space -= s:tabline_evaluated_length(title) + a:sep_size
|
let title_size = s:tabline_evaluated_length(title) + a:sep_size
|
||||||
if a:force || self._remaining_space >= 0
|
if a:force || self._remaining_space >= title_size
|
||||||
let pos = a:pos
|
let pos = a:pos
|
||||||
if has_key(self, "get_pretitle")
|
if has_key(self, "get_pretitle")
|
||||||
call self.insert_raw(self.get_pretitle(a:index), pos)
|
call self.insert_raw(self.get_pretitle(a:index), pos)
|
||||||
|
@ -59,9 +59,8 @@ function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict
|
||||||
let pos += 1
|
let pos += 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let self._remaining_space -= title_size
|
||||||
return 1
|
return 1
|
||||||
else
|
|
||||||
let self._remaining_space += s:tabline_evaluated_length(title) + a:sep_size
|
|
||||||
endif
|
endif
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
Loading…
Reference in New Issue
Block a user