mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-23 02:29:23 +08:00
do not render accents in inactive splits. resolves #270.
This commit is contained in:
parent
bb30c09371
commit
b5e8ea275e
|
@ -23,15 +23,20 @@ function! s:prototype.add_section(group, contents)
|
|||
let self._line .= '%#'.a:group.'#'
|
||||
endif
|
||||
|
||||
let contents = []
|
||||
let content_parts = split(a:contents, '__accent')
|
||||
for cpart in content_parts
|
||||
let accent = matchstr(cpart, '_\zs[^#]*\ze')
|
||||
call airline#highlighter#add_accent(a:group, accent)
|
||||
call add(contents, cpart)
|
||||
endfor
|
||||
let line = join(contents, a:group)
|
||||
let line = substitute(line, '__restore__', a:group, 'g')
|
||||
if self._context.active
|
||||
let contents = []
|
||||
let content_parts = split(a:contents, '__accent')
|
||||
for cpart in content_parts
|
||||
let accent = matchstr(cpart, '_\zs[^#]*\ze')
|
||||
call airline#highlighter#add_accent(a:group, accent)
|
||||
call add(contents, cpart)
|
||||
endfor
|
||||
let line = join(contents, a:group)
|
||||
let line = substitute(line, '__restore__', a:group, 'g')
|
||||
else
|
||||
let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g')
|
||||
let line = substitute(line, '%#__restore__#', '', 'g')
|
||||
endif
|
||||
|
||||
let self._line .= line
|
||||
let self._curgroup = a:group
|
||||
|
|
|
@ -70,5 +70,11 @@ describe 'inactive builder'
|
|||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_inactive#world'
|
||||
end
|
||||
|
||||
it 'should not render accents'
|
||||
call s:builder.add_section('Normal', '%#__accent_foo#hello%#foo#foo%#__accent_bar#world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user