File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -287,10 +287,14 @@ function! s:Bookmark.str()
287287
288288 let pathStr = self .path .str ({' format' : ' UI' })
289289 if strdisplaywidth (pathStr) > pathStrMaxLen
290- while strdisplaywidth (pathStr) > pathStrMaxLen && strchars (pathStr) > 0
291- let pathStr = strcharpart (pathStr, 1 )
292- endwhile
293- let pathStr = ' <' . pathStr
290+ if exists (" *strcharpart" )
291+ while strdisplaywidth (pathStr) > pathStrMaxLen && strchars (pathStr) > 0
292+ let pathStr = strcharpart (pathStr, 1 )
293+ endwhile
294+ let pathStr = ' <' . pathStr
295+ else
296+ let pathStr = ' <' . strpart (pathStr, len (pathStr) - pathStrMaxLen)
297+ endif
294298 endif
295299 return ' >' . self .name . ' ' . pathStr
296300endfunction
Original file line number Diff line number Diff line change @@ -720,9 +720,13 @@ function! s:Path.str(...)
720720 if has_key (options , ' truncateTo' )
721721 let limit = options [' truncateTo' ]
722722 if strdisplaywidth (toReturn) > limit- 1
723- while strdisplaywidth (toReturn) > limit- 1 && strchars (toReturn) > 0
724- let toReturn = strcharpart (toReturn, 1 )
725- endwhile
723+ if exists (" *strcharpart" )
724+ while strdisplaywidth (toReturn) > limit- 1 && strchars (toReturn) > 0
725+ let toReturn = strcharpart (toReturn, 1 )
726+ endwhile
727+ else
728+ let toReturn = toReturn[(len (toReturn)- limit+ 1 ):]
729+ endif
726730 if len (split (toReturn, ' /' )) > 1
727731 let toReturn = ' </' . join (split (toReturn, ' /' )[1 :], ' /' ) . ' /'
728732 else
You can’t perform that action at this time.
0 commit comments