1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:30:04 +08:00

Fix tabline index (#3741)

This commit is contained in:
Wang Shidong 2020-08-30 20:49:56 +08:00 committed by GitHub
parent 91b9560f3d
commit ea23a1d37a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View File

@ -432,6 +432,9 @@ function! SpaceVim#layers#core#statusline#get(...) abort
elseif &filetype ==# 'git-log' elseif &filetype ==# 'git-log'
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep 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 . ' ' \ . '%#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' elseif &filetype ==# 'gina-status'
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep 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 . ' ' \ . '%#SpaceVim_statusline_b# Gina status %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '

View File

@ -56,7 +56,12 @@ let s:i_separators = {
function! s:tabname(bufnr) abort 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) if g:spacevim_enable_tabline_ft_icon || get(g:, 'spacevim_enable_tabline_filetype_icon', 0)
let icon = s:FILE.fticon(fn) let icon = s:FILE.fticon(fn)
if !empty(icon) if !empty(icon)
@ -147,7 +152,7 @@ function! SpaceVim#layers#core#tabline#get() abort
endfor endfor
endif endif
else 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]) call add(shown_items, all_tabline_items[i - 1])
if s:check_len(shown_items) if s:check_len(shown_items)
let matched_len = 1 let matched_len = 1
@ -301,7 +306,7 @@ function! SpaceVim#layers#core#tabline#get() abort
endif endif
else else
if previous_buf_index == -1 if previous_buf_index == -1
let previous_buf_index = len(s:s:buffers) - 1 let previous_buf_index = len(s:buffers) - 1
endif endif
for i in range(current_buf_index, previous_buf_index) for i in range(current_buf_index, previous_buf_index)
call add(shown_items, all_tabline_items[i]) call add(shown_items, all_tabline_items[i])

View File

@ -1,20 +1,12 @@
Execute ( SpaceVim api: job ): Execute ( SpaceVim api: job ):
let job = SpaceVim#api#import('job') let job = SpaceVim#api#import('job')
let os = SpaceVim#api#import('system')
if os.isWindows
finish
endif
let argv = ['cat'] let argv = ['cat']
let g:stdout = '' let g:stdout = ''
let stderr = '' let stderr = ''
let exit_data = 1 let exit_data = 1
function! s:on_stdout(id, data, event) abort function! s:on_stdout(id, data, event) abort
if a:event ==# 'stdout' if a:event ==# 'stdout'
for a in a:data let g:stdout = join(a:data, "\n")
if !empty(a)
let g:stdout = a
endif
endfor
elseif a:event ==# 'exit' elseif a:event ==# 'exit'
let g:exit_data = a:data let g:exit_data = a:data
else else
@ -26,8 +18,8 @@ Execute ( SpaceVim api: job ):
\ 'on_stderr' : function('s:on_stdout'), \ 'on_stderr' : function('s:on_stdout'),
\ 'on_exit' : function('s:on_stdout'), \ 'on_exit' : function('s:on_stdout'),
\ } \ }
let jobid = job.start(argv,opt) if job.vim_job || job.nvim_job
if jobid >= 0 let jobid = job.start(argv,opt)
call job.send(jobid, 'foo') call job.send(jobid, 'foo')
sleep 10m sleep 10m
AssertEqual stdout, 'foo' AssertEqual stdout, 'foo'

0
vimfiler Normal file
View File