mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-23 03:30:59 +08:00
Fixed bug 'unknown function strcharpart' for older versions of Vim
This commit is contained in:
parent
d3a7cd20ae
commit
0972cda243
|
@ -287,10 +287,14 @@ 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)
|
||||
endwhile
|
||||
let pathStr = '<' . pathStr
|
||||
if exists("*strcharpart")
|
||||
while strdisplaywidth(pathStr) > pathStrMaxLen && strchars(pathStr) > 0
|
||||
let pathStr = strcharpart(pathStr, 1)
|
||||
endwhile
|
||||
let pathStr = '<' . pathStr
|
||||
else
|
||||
let pathStr = '<' . strpart(pathStr, len(pathStr) - pathStrMaxLen)
|
||||
endif
|
||||
endif
|
||||
return '>' . self.name . ' ' . pathStr
|
||||
endfunction
|
||||
|
|
|
@ -720,9 +720,13 @@ function! s:Path.str(...)
|
|||
if has_key(options, 'truncateTo')
|
||||
let limit = options['truncateTo']
|
||||
if strdisplaywidth(toReturn) > limit-1
|
||||
while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
|
||||
let toReturn = strcharpart(toReturn, 1)
|
||||
endwhile
|
||||
if exists("*strcharpart")
|
||||
while strdisplaywidth(toReturn) > limit-1 && strchars(toReturn) > 0
|
||||
let toReturn = strcharpart(toReturn, 1)
|
||||
endwhile
|
||||
else
|
||||
let toReturn = toReturn[(len(toReturn)-limit+1):]
|
||||
endif
|
||||
if len(split(toReturn, '/')) > 1
|
||||
let toReturn = '</' . join(split(toReturn, '/')[1:], '/') . '/'
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user