Merge pull request #834 from bravestarr/fix-multibyte-path
Replace strcharpart() with substitute() for backward compatibility
This commit is contained in:
commit
925a96f58d
@ -287,14 +287,10 @@ function! s:Bookmark.str()
|
|||||||
|
|
||||||
let pathStr = self.path.str({'format': 'UI'})
|
let pathStr = self.path.str({'format': 'UI'})
|
||||||
if strdisplaywidth(pathStr) > pathStrMaxLen
|
if strdisplaywidth(pathStr) > pathStrMaxLen
|
||||||
if exists("*strcharpart")
|
|
||||||
while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0
|
while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0
|
||||||
let pathStr = strcharpart(pathStr, 1)
|
let pathStr = substitute(pathStr, '^.', '', '')
|
||||||
endwhile
|
endwhile
|
||||||
let pathStr = '<' . pathStr
|
let pathStr = '<' . pathStr
|
||||||
else
|
|
||||||
let pathStr = '<' . strpart(pathStr, len(pathStr) - pathStrMaxLen)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
return '>' . self.name . ' ' . pathStr
|
return '>' . self.name . ' ' . pathStr
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -720,13 +720,9 @@ function! s:Path.str(...)
|
|||||||
if has_key(options, 'truncateTo')
|
if has_key(options, 'truncateTo')
|
||||||
let limit = options['truncateTo']
|
let limit = options['truncateTo']
|
||||||
if strdisplaywidth(toReturn) > limit-1
|
if strdisplaywidth(toReturn) > limit-1
|
||||||
if exists("*strcharpart")
|
|
||||||
while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
|
while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
|
||||||
let toReturn = strcharpart(toReturn, 1)
|
let toReturn = substitute(toReturn, '^.', '', '')
|
||||||
endwhile
|
endwhile
|
||||||
else
|
|
||||||
let toReturn = toReturn[(len(toReturn)-limit+1):]
|
|
||||||
endif
|
|
||||||
if len(split(toReturn, '/')) > 1
|
if len(split(toReturn, '/')) > 1
|
||||||
let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'
|
let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user