Replace strchars() with a backward compatible workaround.

This commit is contained in:
Phil Runninger
2016-08-26 08:59:25 -04:00
parent 0b73db9368
commit 4428aba2a2

View File

@@ -282,7 +282,8 @@ endfunction
function! s:UI._indentLevelFor(line) function! s:UI._indentLevelFor(line)
"have to do this work around because match() returns bytes, not chars "have to do this work around because match() returns bytes, not chars
let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']') let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']')
let leadChars = strchars(a:line[0:numLeadBytes-1]) " The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+
let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs'))
return leadChars / s:UI.IndentWid() return leadChars / s:UI.IndentWid()
endfunction endfunction