Add support for get_pretitle and get_posttitle to tabline builder

This commit is contained in:
mrmr1993 2018-03-15 19:41:58 +00:00
parent e6b6f36d90
commit 3cd8daa162

View File

@ -17,8 +17,23 @@ function! s:prototype.try_insert_tab(tab, pos, sep_size, force) dict
let tab_title = self.get_title(a:tab) let tab_title = self.get_title(a:tab)
let self._remaining_space -= s:strchars(s:evaluate_tabline(tab_title)) + a:sep_size let self._remaining_space -= s:strchars(s:evaluate_tabline(tab_title)) + a:sep_size
if a:force || self._remaining_space >= 0 if a:force || self._remaining_space >= 0
call self.insert_section(self.get_group(a:tab), tab_title, a:pos) let pos = a:pos
if has_key(self, "get_pretitle")
call self.insert_raw(self.get_pretitle(a:tab), pos)
let self._right_position += 1
let pos += 1
endif
call self.insert_section(self.get_group(a:tab), tab_title, pos)
let self._right_position += 1 let self._right_position += 1
let pos += 1
if has_key(self, "get_posttitle")
call self.insert_raw(self.get_posttitle(a:tab), pos)
let self._right_position += 1
let pos += 1
endif
return 1 return 1
endif endif
return 0 return 0