Merge pull request #672 from zhouyan/patch-1

Use `strchars` for calculating line length
This commit is contained in:
Karl Yngve Lervåg 2017-01-24 20:46:29 +01:00 committed by GitHub
commit 7c1b6c02e7

View File

@ -110,7 +110,7 @@ function! s:format(top, bottom) " {{{1
endif
" Handle long lines
if len(l:line) > s:textwidth
if strchars(l:line) > s:textwidth
let l:bottom += s:format_build_lines(l:current, l:mark)
let l:mark = l:current-1
endif
@ -160,7 +160,7 @@ function! s:format_build_lines(start, end) " {{{1
let l:lnum = a:start-1
let l:current = repeat(' ', indent(a:start))
for l:word in l:words
if len(l:word) + len(l:current) > s:textwidth
if strchars(l:word) + strchars(l:current) > s:textwidth
call append(l:lnum, substitute(l:current, '\s$', '', ''))
let l:lnum += 1
let l:current = repeat(' ', VimtexIndent(a:start))