Bug fix: length of composite characters in stl_format.

This commit is contained in:
LCD 47 2015-09-23 17:48:39 +03:00
parent 66f4e96937
commit b8aef009b1
2 changed files with 4 additions and 7 deletions

View File

@ -369,15 +369,13 @@ function! syntastic#util#wformat(format, str) abort " {{{2
let out = substitute(a:str, "\t", ' ', 'g') let out = substitute(a:str, "\t", ' ', 'g')
if maxlen && s:_width(out) > maxlen if maxlen && s:_width(out) > maxlen
let chars = filter(split(a:str, '\zs\ze', 1), 'v:val !=# ""') let chars = filter(split(out, '\zs\ze', 1), 'v:val !=# ""')
let totlen = 0
let out = '' let out = ''
if flushleft if flushleft
for c in chars for c in chars
if totlen + s:_width(c) < maxlen if s:_width(out . c) < maxlen
let out .= c let out .= c
let totlen += s:_width(c)
else else
let out .= &encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '>' let out .= &encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '>'
break break
@ -386,9 +384,8 @@ function! syntastic#util#wformat(format, str) abort " {{{2
else else
call reverse(chars) call reverse(chars)
for c in chars for c in chars
if totlen + s:_width(c) < maxlen if s:_width(c . out) < maxlen
let out = c . out let out = c . out
let totlen += s:_width(c)
else else
let out = (&encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '<') . out let out = (&encoding ==# 'utf-8' && &termencoding ==# 'utf-8' ? "\u2026" : '<') . out
break break

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.6.0-173' let g:_SYNTASTIC_VERSION = '3.6.0-174'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1