fix for previous commit

This commit is contained in:
Kien N 2011-09-09 06:06:24 +07:00
parent 1daeb3291d
commit 72e172db01

View File

@ -123,26 +123,33 @@ func! ctrlp#clearallcaches()
endfunc endfunc
"}}} "}}}
" s:ListAllFiles(path) {{{ " ListAllFiles {{{
func! s:List(path) func! s:List(dirs, allfiles)
" note: wildignore is ignored when using **, so find all the directories " note: wildignore is ignored when using **
" first then glob with * for the files let entries = split(globpath(a:dirs, '*'), '\n')
let alldirs = split(globpath(a:path, '**'), '\n') let entries_copy = deepcopy(entries)
cal filter(alldirs, 'isdirectory(v:val)') let alldirs = filter(entries, 'isdirectory(v:val)')
let dirs = join(alldirs, ',') let allfiles = filter(entries_copy, '!isdirectory(v:val)')
let allfiles = split(globpath(a:path, '*'), '\n') if empty(allfiles)
let allfiles = extend(allfiles, split(globpath(dirs, '*'), '\n')) let allfiles = a:allfiles
cal filter(allfiles, '!isdirectory(v:val)') else
" remove base directory cal extend(allfiles, a:allfiles)
let path = &ssl || !exists('+ssl') ? getcwd().'/' : substitute(getcwd(), '\', '\\\\', 'g').'\\' endif
cal map(allfiles, 'substitute(v:val, path, "", "g")') if empty(alldirs)
retu allfiles let s:allfiles = allfiles
else
let dirs = join(alldirs, ',')
cal s:List(dirs, allfiles)
endif
endfunc endfunc
func! s:ListAllFiles(path) func! s:ListAllFiles(path)
let cache_file = ctrlp#utils#cachefile() let cache_file = ctrlp#utils#cachefile()
if g:ctrlp_newcache || !filereadable(cache_file) || !s:caching if g:ctrlp_newcache || !filereadable(cache_file) || !s:caching
let allfiles = s:List(a:path) cal s:List(a:path, [])
let allfiles = s:allfiles
let path = &ssl || !exists('+ssl') ? getcwd().'/' : substitute(getcwd(), '\', '\\\\', 'g').'\\'
cal map(allfiles, 'substitute(v:val, path, "", "g")')
let read_cache = 0 let read_cache = 0
else else
let allfiles = ctrlp#utils#readfile(cache_file) let allfiles = ctrlp#utils#readfile(cache_file)
@ -500,7 +507,7 @@ func! s:PrtClearCache()
endfunc endfunc
"}}} "}}}
" s:MapKeys() {{{ " MapKeys {{{
func! s:MapKeys(...) func! s:MapKeys(...)
" Normal keystrokes " Normal keystrokes
let func = !exists('a:1') || ( exists('a:1') && a:1 ) ? 'PrtAdd' : 'PrtSelectJump' let func = !exists('a:1') || ( exists('a:1') && a:1 ) ? 'PrtAdd' : 'PrtSelectJump'
@ -580,7 +587,7 @@ func! s:MapSpecs(...)
endfunc endfunc
"}}} "}}}
" s:ToggleFocus() {{{ " ToggleFocus {{{
func! s:Focus() func! s:Focus()
retu !exists('b:focus') ? 1 : b:focus retu !exists('b:focus') ? 1 : b:focus
endfunc endfunc
@ -763,13 +770,6 @@ func! s:syntax()
hi link CtrlPNoEntries Error hi link CtrlPNoEntries Error
hi CtrlPLineMarker guifg=bg hi CtrlPLineMarker guifg=bg
endfunc endfunc
func! s:uniquefilter(val, pats)
for each in a:pats
if match(each, a:val) >= 0 && len(a:val) < len(each) | retu 0 | endif
endfor
retu 1
endfunc
"}}} "}}}
func! s:SetLines(type) "{{{ func! s:SetLines(type) "{{{