Replace strcharpart() with substitute() for backward compatibility

This commit is contained in:
bravestarr 2018-04-26 17:13:06 +08:00
parent 6aff1b6cd3
commit b45f2c27ea
2 changed files with 2 additions and 2 deletions

View File

@ -288,7 +288,7 @@ function! s:Bookmark.str()
let pathStr = self.path.str({'format': 'UI'})
if strdisplaywidth(pathStr) > pathStrMaxLen
while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0
let pathStr = strcharpart(pathStr, 1)
let pathStr = substitute(pathStr, '.\{1}', '', '')
endwhile
let pathStr = '<' . pathStr
endif

View File

@ -721,7 +721,7 @@ function! s:Path.str(...)
let limit = options['truncateTo']
if strdisplaywidth(toReturn) > limit-1
while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
let toReturn = strcharpart(toReturn, 1)
let toReturn = substitute(toReturn, '.\{1}', '', '')
endwhile
if len(split(toReturn, '/')) > 1
let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'