From 5ecc25d6d6799097e8ae98d74a39c6e09a08a48b Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Thu, 15 Mar 2018 18:14:50 +0000 Subject: [PATCH] Move tab_nr_type into tabs get_title --- autoload/airline/extensions/tabline/builder.vim | 13 ++++++------- autoload/airline/extensions/tabline/tabs.vim | 5 +++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoload/airline/extensions/tabline/builder.vim b/autoload/airline/extensions/tabline/builder.vim index 5e3621b..16ba3a3 100644 --- a/autoload/airline/extensions/tabline/builder.vim +++ b/autoload/airline/extensions/tabline/builder.vim @@ -12,8 +12,8 @@ function! s:prototype.insert_tabs(curtab) dict let self._right_position = self._left_position endfunction -function! s:prototype.try_insert_tab(tab, pos, tab_nr_type, sep_size, force) dict - let tab_title = self.get_title(a:tab_nr_type, a:tab) +function! s:prototype.try_insert_tab(tab, pos, sep_size, force) dict + let tab_title = self.get_title(a:tab) let self._remaining_space -= s:strchars(s:evaluate_tabline(tab_title)) + a:sep_size if a:force || self._remaining_space >= 0 call self.insert_section(self.get_group(a:tab), tab_title, a:pos) @@ -25,7 +25,6 @@ endfunction function! s:prototype.build() dict if has_key(self, '_left_position') - let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let num_tabs = tabpagenr('$') let self._remaining_space = &columns - s:strchars(s:evaluate_tabline(self._build())) @@ -43,7 +42,7 @@ function! s:prototype.build() dict " Add the current tab let self._left_tab -= - \ self.try_insert_tab(self._left_tab, self._left_position, tab_nr_type, left_sep_size, 1) + \ self.try_insert_tab(self._left_tab, self._left_position, left_sep_size, 1) if get(g:, 'airline#extensions#tabline#current_first', 0) " always have current tabpage first @@ -53,16 +52,16 @@ function! s:prototype.build() dict " Add the tab to the right if self._right_tab <= num_tabs let self._right_tab += - \ self.try_insert_tab(self._right_tab, self._right_position, tab_nr_type, left_alt_sep_size, 1) + \ self.try_insert_tab(self._right_tab, self._right_position, left_alt_sep_size, 1) endif while self._remaining_space > 0 if self._left_tab > 0 let self._left_tab -= - \ self.try_insert_tab(self._left_tab, self._left_position, tab_nr_type, left_alt_sep_size, 0) + \ self.try_insert_tab(self._left_tab, self._left_position, left_alt_sep_size, 0) elseif self._right_tab <= num_tabs let self._right_tab += - \ self.try_insert_tab(self._right_tab, self._right_position, tab_nr_type, left_alt_sep_size, 0) + \ self.try_insert_tab(self._right_tab, self._right_position, left_alt_sep_size, 0) else break endif diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index 2e2704c..d238473 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -60,11 +60,12 @@ function! airline#extensions#tabline#tabs#get() return group endfunction - function! b.get_title(tab_nr_type, i) dict + function! b.get_title(i) dict let val = '%(' if get(g:, 'airline#extensions#tabline#show_tab_nr', 1) - let val .= airline#extensions#tabline#tabs#tabnr_formatter(a:tab_nr_type, a:i) + let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) + let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, a:i) endif return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)'