do not render accents in inactive splits. resolves #270.

This commit is contained in:
Bailey Ling 2013-09-22 17:15:02 -04:00
parent bb30c09371
commit b5e8ea275e
2 changed files with 20 additions and 9 deletions

View File

@ -23,6 +23,7 @@ function! s:prototype.add_section(group, contents)
let self._line .= '%#'.a:group.'#'
endif
if self._context.active
let contents = []
let content_parts = split(a:contents, '__accent')
for cpart in content_parts
@ -32,6 +33,10 @@ function! s:prototype.add_section(group, contents)
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

View File

@ -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