Reset _remaining_space if a title can't be inserted

This gives us a chance to add the title on the other side if it will
fit, so that we fill more space in the tabline.
This commit is contained in:
mrmr1993 2018-03-17 19:59:47 +00:00
parent d13305fc5d
commit 896c14bded
1 changed files with 6 additions and 6 deletions

View File

@ -36,6 +36,8 @@ function! s:prototype.try_insert_tab(tab, pos, sep_size, force) dict
endif
return 1
else
let self._remaining_space += s:strchars(s:evaluate_tabline(tab_title)) + a:sep_size
endif
return 0
endfunction
@ -76,14 +78,12 @@ function! s:prototype.build() dict
while self._remaining_space > 0
let done = 0
if self._left_tab >= self._first_tab
let self._left_tab -=
\ self.try_insert_tab(self._left_tab, self._left_position, left_alt_sep_size, 0)
let done = 1
let done = self.try_insert_tab(self._left_tab, self._left_position, left_alt_sep_size, 0)
let self._left_tab -= done
endif
if self._right_tab <= self._last_tab && (center_active || !done)
let self._right_tab +=
\ self.try_insert_tab(self._right_tab, self._right_position, left_alt_sep_size, 0)
let done = 1
let done = self.try_insert_tab(self._right_tab, self._right_position, left_alt_sep_size, 0)
let self._right_tab += done
endif
if !done
break