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.'#'
|
let self._line .= '%#'.a:group.'#'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let contents = []
|
if self._context.active
|
||||||
let content_parts = split(a:contents, '__accent')
|
let contents = []
|
||||||
for cpart in content_parts
|
let content_parts = split(a:contents, '__accent')
|
||||||
let accent = matchstr(cpart, '_\zs[^#]*\ze')
|
for cpart in content_parts
|
||||||
call airline#highlighter#add_accent(a:group, accent)
|
let accent = matchstr(cpart, '_\zs[^#]*\ze')
|
||||||
call add(contents, cpart)
|
call airline#highlighter#add_accent(a:group, accent)
|
||||||
endfor
|
call add(contents, cpart)
|
||||||
let line = join(contents, a:group)
|
endfor
|
||||||
let line = substitute(line, '__restore__', a:group, 'g')
|
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._line .= line
|
||||||
let self._curgroup = a:group
|
let self._curgroup = a:group
|
||||||
|
|
|
@ -70,5 +70,11 @@ describe 'inactive builder'
|
||||||
let stl = s:builder.build()
|
let stl = s:builder.build()
|
||||||
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_inactive#world'
|
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_inactive#world'
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue