Check and append ending slashes

Fixes #434
Fixes #437
This commit is contained in:
Kien N 2013-07-02 21:25:51 +07:00
parent 8903fe5e18
commit 12c53bdbb9
2 changed files with 4 additions and 5 deletions

View File

@ -617,9 +617,8 @@ fu! s:SetDefTxt()
if s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en if s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en
let txt = s:deftxt let txt = s:deftxt
if !type(txt) if !type(txt)
let txt = txt && !stridx(s:crfpath, s:dyncwd) let path = s:crfpath.s:lash(s:crfpath)
\ ? ctrlp#rmbasedir([s:crfpath])[0] : '' let txt = txt && !stridx(path, s:dyncwd) ? ctrlp#rmbasedir([path])[0] : ''
let txt = txt != '' ? txt.s:lash(s:crfpath) : ''
en en
let s:prompt[0] = txt let s:prompt[0] = txt
endf endf
@ -1542,7 +1541,7 @@ fu! s:samerootsyml(each, isfile, cwd)
endf endf
fu! ctrlp#rmbasedir(items) fu! ctrlp#rmbasedir(items)
let cwd = s:dyncwd.( s:dyncwd !~ '[\/]$' ? s:lash : '' ) let cwd = s:dyncwd.s:lash()
if a:items != [] && !stridx(a:items[0], cwd) if a:items != [] && !stridx(a:items[0], cwd)
let idx = strlen(cwd) let idx = strlen(cwd)
retu map(a:items, 'strpart(v:val, idx)') retu map(a:items, 'strpart(v:val, idx)')

View File

@ -74,7 +74,7 @@ fu! ctrlp#dir#init(...)
endf endf
fu! ctrlp#dir#accept(mode, str) fu! ctrlp#dir#accept(mode, str)
let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#utils#lash().a:str let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#call('s:lash', s:cwd).a:str
if a:mode =~ 't\|v\|h' if a:mode =~ 't\|v\|h'
cal ctrlp#exit() cal ctrlp#exit()
en en