diff --git a/autoload/airline/extensions/tabline/buffers.vim b/autoload/airline/extensions/tabline/buffers.vim index 512d517..ff6e34f 100644 --- a/autoload/airline/extensions/tabline/buffers.vim +++ b/autoload/airline/extensions/tabline/buffers.vim @@ -143,11 +143,11 @@ function! airline#extensions#tabline#buffers#get() let s:column_width = &columns let s:current_tabline = b.build() let s:current_visible_buffers = copy(b.buffers) - if b._right_tab <= last_buffer - call remove(s:current_visible_buffers, b._right_tab, last_buffer) + if b._right_title <= last_buffer + call remove(s:current_visible_buffers, b._right_title, last_buffer) endif - if b._left_tab > 0 - call remove(s:current_visible_buffers, 0, b._left_tab) + if b._left_title > 0 + call remove(s:current_visible_buffers, 0, b._left_title) endif return s:current_tabline endfunction diff --git a/autoload/airline/extensions/tabline/builder.vim b/autoload/airline/extensions/tabline/builder.vim index 1a09a59..2ce97c7 100644 --- a/autoload/airline/extensions/tabline/builder.vim +++ b/autoload/airline/extensions/tabline/builder.vim @@ -5,39 +5,39 @@ scriptencoding utf-8 let s:prototype = {} -function! s:prototype.insert_titles(curtab, first_tab, last_tab) dict - let self._first_tab = a:first_tab - let self._last_tab = a:last_tab - let self._left_tab = a:curtab - let self._right_tab = a:curtab + 1 +function! s:prototype.insert_titles(current, first, last) dict + let self._first_title = a:first + let self._last_title = a:last + let self._left_title = a:current + let self._right_title = a:current + 1 let self._left_position = self.get_position() let self._right_position = self._left_position endfunction -function! s:prototype.try_insert_title(tab, group, 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 +function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict + let title = self.get_title(a:index) + let self._remaining_space -= s:strchars(s:evaluate_tabline(title)) + a:sep_size if a:force || self._remaining_space >= 0 let pos = a:pos if has_key(self, "get_pretitle") - call self.insert_raw(self.get_pretitle(a:tab), pos) + call self.insert_raw(self.get_pretitle(a:index), pos) let self._right_position += 1 let pos += 1 endif - call self.insert_section(a:group, tab_title, pos) + call self.insert_section(a:group, title, pos) let self._right_position += 1 let pos += 1 if has_key(self, "get_posttitle") - call self.insert_raw(self.get_posttitle(a:tab), pos) + call self.insert_raw(self.get_posttitle(a:index), pos) let self._right_position += 1 let pos += 1 endif return 1 else - let self._remaining_space += s:strchars(s:evaluate_tabline(tab_title)) + a:sep_size + let self._remaining_space += s:strchars(s:evaluate_tabline(title)) + a:sep_size endif return 0 endfunction @@ -73,55 +73,55 @@ function! s:prototype.build() dict let outer_left_group = airline#builder#get_prev_group(self._sections, self._left_position) let outer_right_group = airline#builder#get_next_group(self._sections, self._right_position) - " Add the current tab - let group = self.get_group(self._left_tab) + " Add the current title + let group = self.get_group(self._left_title) let sep_change = \ s:get_separator_change(group, "", outer_left_group, sep_size, alt_sep_size) + \ s:get_separator_change(group, "", outer_right_group, sep_size, alt_sep_size) let left_group = group let right_group = group - let self._left_tab -= - \ self.try_insert_title(self._left_tab, group, self._left_position, sep_change, 1) + let self._left_title -= + \ self.try_insert_title(self._left_title, group, self._left_position, sep_change, 1) if get(g:, 'airline#extensions#tabline#current_first', 0) - " always have current tabpage first + " always have current title first let self._left_position += 1 endif - " Add the tab to the right - if !center_active && self._right_tab <= self._last_tab - let group = self.get_group(self._right_tab) + " Add the title to the right + if !center_active && self._right_title <= self._last_title + let group = self.get_group(self._right_title) let sep_change = \ s:get_separator_change(group, right_group, outer_right_group, sep_size, alt_sep_size) let right_group = group - let self._right_tab += - \ self.try_insert_title(self._right_tab, group, self._right_position, sep_change, 1) + let self._right_title += + \ self.try_insert_title(self._right_title, group, self._right_position, sep_change, 1) endif while self._remaining_space > 0 let done = 0 - if self._left_tab >= self._first_tab - let group = self.get_group(self._left_tab) + if self._left_title >= self._first_title + let group = self.get_group(self._left_title) let sep_change = \ s:get_separator_change(group, left_group, outer_left_group, sep_size, alt_sep_size) let left_group = group - let done = self.try_insert_title(self._left_tab, group, self._left_position, sep_change, 0) - let self._left_tab -= done + let done = self.try_insert_title(self._left_title, group, self._left_position, sep_change, 0) + let self._left_title -= done endif - if self._right_tab <= self._last_tab && (center_active || !done) - let group = self.get_group(self._right_tab) + if self._right_title <= self._last_title && (center_active || !done) + let group = self.get_group(self._right_title) let sep_change = \ s:get_separator_change(group, right_group, outer_right_group, sep_size, alt_sep_size) let right_group = group - let done = self.try_insert_title(self._right_tab, group, self._right_position, sep_change, 0) - let self._right_tab += done + let done = self.try_insert_title(self._right_title, group, self._right_position, sep_change, 0) + let self._right_title += done endif if !done break endif endwhile - if self._left_tab >= self._first_tab + if self._left_title >= self._first_title if get(g:, 'airline#extensions#tabline#current_first', 0) let self._left_position -= 1 endif @@ -129,7 +129,7 @@ function! s:prototype.build() dict let self._right_position += 1 endif - if self._right_tab <= self._last_tab + if self._right_title <= self._last_title call self.insert_raw('%#'.self.overflow_group.'#'.overflow_marker, self._right_position) endif endif