diff --git a/autoload/lightline.vim b/autoload/lightline.vim index a63f874..4fa773b 100644 --- a/autoload/lightline.vim +++ b/autoload/lightline.vim @@ -2,7 +2,7 @@ " Filename: autoload/lightline.vim " Author: itchyny " License: MIT License -" Last Change: 2020/09/05 20:57:51. +" Last Change: 2020/09/25 10:56:16. " ============================================================================= let s:save_cpo = &cpo @@ -290,6 +290,7 @@ function! lightline#highlight(...) abort endfor exec printf('hi LightlineMiddle_%s guifg=%s guibg=%s ctermfg=%s ctermbg=%s %s', mode, ms[0], ms[1], ms[2], ms[3], s:term(ms)) endfor + if !a:0 | let s:mode = '' | endif endfunction function! s:subseparator(components, subseparator, expanded) abort diff --git a/test/link.vim b/test/link.vim index 98e409e..3da8ea1 100644 --- a/test/link.vim +++ b/test/link.vim @@ -141,3 +141,17 @@ function! s:suite.component_type() endfor endfor endfunction + +function! s:suite.hi_clear() + call lightline#link() + colorscheme default + call lightline#link() + call s:assert.match(s:hi('LightlineLeft_active_0'), 'LightlineLeft_normal_0') + call s:assert.match(s:hi('LightlineLeft_active_1'), 'LightlineLeft_normal_1') + call s:assert.match(s:hi('LightlineLeft_active_2'), 'E411: highlight group not found\|cleared') + call s:assert.match(s:hi('LightlineRight_active_0'), 'LightlineRight_normal_0') + call s:assert.match(s:hi('LightlineRight_active_1'), 'LightlineRight_normal_1') + call s:assert.match(s:hi('LightlineRight_active_2'), 'LightlineRight_normal_2') + call s:assert.match(s:hi('LightlineRight_active_3'), 'E411: highlight group not found\|cleared') + call s:assert.match(s:hi('LightlineMiddle_active'), 'LightlineMiddle_normal') +endfunction