mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:00:04 +08:00
Fix tabline index (#3741)
This commit is contained in:
parent
91b9560f3d
commit
ea23a1d37a
@ -432,6 +432,9 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
elseif &filetype ==# 'git-log'
|
||||
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# Git log %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
|
||||
elseif &filetype ==# 'vader-result'
|
||||
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# Vader result %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
|
||||
elseif &filetype ==# 'gina-status'
|
||||
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# Gina status %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
|
||||
|
@ -56,7 +56,12 @@ let s:i_separators = {
|
||||
|
||||
|
||||
function! s:tabname(bufnr) abort
|
||||
let fn = fnamemodify(bufname(a:bufnr), ':t')
|
||||
let name = bufname(a:bufnr)
|
||||
if name ==# '\[Vader\]'
|
||||
let fn = '[Vader]'
|
||||
else
|
||||
let fn = fnamemodify(name, ':t')
|
||||
endif
|
||||
if g:spacevim_enable_tabline_ft_icon || get(g:, 'spacevim_enable_tabline_filetype_icon', 0)
|
||||
let icon = s:FILE.fticon(fn)
|
||||
if !empty(icon)
|
||||
@ -147,7 +152,7 @@ function! SpaceVim#layers#core#tabline#get() abort
|
||||
endfor
|
||||
endif
|
||||
else
|
||||
for i in range(current_tabnr, previous_tabnr)
|
||||
for i in range(current_tabnr, previous_tabnr > tabpage_counts ? tabpage_counts : previous_tabnr)
|
||||
call add(shown_items, all_tabline_items[i - 1])
|
||||
if s:check_len(shown_items)
|
||||
let matched_len = 1
|
||||
@ -301,7 +306,7 @@ function! SpaceVim#layers#core#tabline#get() abort
|
||||
endif
|
||||
else
|
||||
if previous_buf_index == -1
|
||||
let previous_buf_index = len(s:s:buffers) - 1
|
||||
let previous_buf_index = len(s:buffers) - 1
|
||||
endif
|
||||
for i in range(current_buf_index, previous_buf_index)
|
||||
call add(shown_items, all_tabline_items[i])
|
||||
|
@ -1,20 +1,12 @@
|
||||
Execute ( SpaceVim api: job ):
|
||||
let job = SpaceVim#api#import('job')
|
||||
let os = SpaceVim#api#import('system')
|
||||
if os.isWindows
|
||||
finish
|
||||
endif
|
||||
let argv = ['cat']
|
||||
let g:stdout = ''
|
||||
let stderr = ''
|
||||
let exit_data = 1
|
||||
function! s:on_stdout(id, data, event) abort
|
||||
if a:event ==# 'stdout'
|
||||
for a in a:data
|
||||
if !empty(a)
|
||||
let g:stdout = a
|
||||
endif
|
||||
endfor
|
||||
let g:stdout = join(a:data, "\n")
|
||||
elseif a:event ==# 'exit'
|
||||
let g:exit_data = a:data
|
||||
else
|
||||
@ -26,8 +18,8 @@ Execute ( SpaceVim api: job ):
|
||||
\ 'on_stderr' : function('s:on_stdout'),
|
||||
\ 'on_exit' : function('s:on_stdout'),
|
||||
\ }
|
||||
let jobid = job.start(argv,opt)
|
||||
if jobid >= 0
|
||||
if job.vim_job || job.nvim_job
|
||||
let jobid = job.start(argv,opt)
|
||||
call job.send(jobid, 'foo')
|
||||
sleep 10m
|
||||
AssertEqual stdout, 'foo'
|
||||
|
Loading…
Reference in New Issue
Block a user