1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-23 17:49:57 +08:00

fix(highlight.vim): fix list index out of range

This commit is contained in:
wsdjeg 2022-03-22 11:42:13 +08:00
parent 561da4ffbd
commit 0f336f386e
2 changed files with 4 additions and 2 deletions

View File

@ -309,7 +309,9 @@ function! s:highlight() abort
for item in s:stack for item in s:stack
call add(s:highlight_id, s:CMP.matchaddpos('HiBlueBold', [ item ])) call add(s:highlight_id, s:CMP.matchaddpos('HiBlueBold', [ item ]))
endfor endfor
let s:highlight_id_c = s:CMP.matchaddpos('HiPurpleBold', [s:stack[s:index]]) if !empty(get(s:stack, s:index, []))
let s:highlight_id_c = s:CMP.matchaddpos('HiPurpleBold', [s:stack[s:index]])
endif
endfunction endfunction
" }}} " }}}

View File

@ -7,7 +7,7 @@ Given (fixture):
Hello Hello
Hello Hello
Execute ( SpaceVim plugin: iedit ): Execute ( SpaceVim plugin: highlight.vim `SPC s h/H` ):
let g:_spacevim_input_list = ['e', 'D', 'a', 'W', 'o', 'r', 'l', 'd', "\<Esc>", "\<Esc>"] let g:_spacevim_input_list = ['e', 'D', 'a', 'W', 'o', 'r', 'l', 'd', "\<Esc>", "\<Esc>"]
call SpaceVim#plugins#highlight#start() call SpaceVim#plugins#highlight#start()