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

View File

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