diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 1b6b8c5c..28184465 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -1762,16 +1762,22 @@ fu! s:formatline2(ct, key, str) let str .= printf(' %s', parts[3]) en en + retu s:lineprefix.str en - let cond = a:ct != 'buf' &&s:ispath && ( s:winw - 4 ) < s:strwidth(str) + let cond = s:ispath && ( s:winw - 4 ) < strchars(str) retu s:lineprefix.( cond ? s:pathshorten(str) : str ) endf - -fu! s:pathshorten(str) - retu matchstr(a:str, '^.\{9}').'...' - \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') -endf +if exists('*strchars') && exists('*strcharpart') + fu! s:pathshorten(str) + retu strcharpart(a:str, 0, 9).'...'.strcharpart(a:str, strchars(a:str) - s:winw + 16) + endf +el + fu! s:pathshorten(str) + retu matchstr(a:str, '^.\{9}').'...' + \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') + endf +en fu! s:offset(lines, height) let s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0