Take the first tab number in tabline/builder.insert_tabs
This commit is contained in:
parent
3cd8daa162
commit
d9e68039b8
@ -5,8 +5,9 @@ scriptencoding utf-8
|
|||||||
|
|
||||||
let s:prototype = {}
|
let s:prototype = {}
|
||||||
|
|
||||||
function! s:prototype.insert_tabs(curtab, numtabs) dict
|
function! s:prototype.insert_tabs(curtab, first_tab, last_tab) dict
|
||||||
let self._num_tabs = a:numtabs
|
let self._first_tab = a:first_tab
|
||||||
|
let self._last_tab = a:last_tab
|
||||||
let self._left_tab = a:curtab
|
let self._left_tab = a:curtab
|
||||||
let self._right_tab = a:curtab + 1
|
let self._right_tab = a:curtab + 1
|
||||||
let self._left_position = self.get_position()
|
let self._left_position = self.get_position()
|
||||||
@ -65,16 +66,16 @@ function! s:prototype.build() dict
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Add the tab to the right
|
" Add the tab to the right
|
||||||
if self._right_tab <= self._num_tabs
|
if self._right_tab <= self._last_tab
|
||||||
let self._right_tab +=
|
let self._right_tab +=
|
||||||
\ self.try_insert_tab(self._right_tab, self._right_position, left_alt_sep_size, 1)
|
\ self.try_insert_tab(self._right_tab, self._right_position, left_alt_sep_size, 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
while self._remaining_space > 0
|
while self._remaining_space > 0
|
||||||
if self._left_tab > 0
|
if self._left_tab >= self._first_tab
|
||||||
let self._left_tab -=
|
let self._left_tab -=
|
||||||
\ 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)
|
||||||
elseif self._right_tab <= self._num_tabs
|
elseif self._right_tab <= self._last_tab
|
||||||
let self._right_tab +=
|
let self._right_tab +=
|
||||||
\ 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)
|
||||||
else
|
else
|
||||||
@ -82,7 +83,7 @@ function! s:prototype.build() dict
|
|||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
if self._left_tab > 0
|
if self._left_tab >= self._first_tab
|
||||||
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
if get(g:, 'airline#extensions#tabline#current_first', 0)
|
||||||
let self._left_position -= 1
|
let self._left_position -= 1
|
||||||
endif
|
endif
|
||||||
@ -90,7 +91,7 @@ function! s:prototype.build() dict
|
|||||||
let self._right_position += 1
|
let self._right_position += 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if self._right_tab <= self._num_tabs
|
if self._right_tab <= self._last_tab
|
||||||
call self.insert_raw('%#airline_tab#'.skipped_tabs_marker, self._right_position)
|
call self.insert_raw('%#airline_tab#'.skipped_tabs_marker, self._right_position)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -71,7 +71,7 @@ function! airline#extensions#tabline#tabs#get()
|
|||||||
return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)'
|
return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call b.insert_tabs(curtab, tabpagenr('$'))
|
call b.insert_tabs(curtab, 1, tabpagenr('$'))
|
||||||
|
|
||||||
call b.add_section('airline_tabfill', '')
|
call b.add_section('airline_tabfill', '')
|
||||||
call b.split()
|
call b.split()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user