support multiple accents in the same section (#203).

This commit is contained in:
Bailey Ling
2013-09-18 21:31:39 -04:00
parent fdbf2c05a5
commit 9d5a1744a1
4 changed files with 27 additions and 6 deletions

View File

@@ -23,12 +23,17 @@ function! s:prototype.add_section(group, contents)
let self._line .= '%#'.a:group.'#'
endif
let accent = matchstr(a:contents, 'airline_accent_\zs[^#]*\ze')
let contents = substitute(a:contents, 'airline_accent', a:group, 'g')
if contents != a:contents
let contents = []
let content_parts = split(a:contents, 'airline_accent')
for cpart in content_parts
let accent = matchstr(cpart, '_\zs[^#]*\ze')
call airline#highlighter#add_accent(a:group, accent)
endif
let self._line .= contents
call add(contents, cpart)
endfor
let line = join(contents, a:group)
let line = substitute(line, '__restore__', a:group, 'g')
let self._line .= line
let self._curgroup = a:group
endfunction

View File

@@ -49,6 +49,9 @@ function! s:create(parts, append)
endif
let val .= partval
if exists('part.accent')
let val .= '%#__restore__#'
endif
let _ .= val
endfor
return _