Skip to content

Commit 7732c0a

Browse files
committed
Fix :Efixture behavior when no file found
1 parent 854cbfa commit 7732c0a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

autoload/rails.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,19 @@ function! s:app_has_file(file) dict abort
253253
endfunction
254254

255255
function! s:find_file(name, ...) abort
256-
let path = s:pathsplit(a:0 ? a:1 : &path)
257-
let index = 1
256+
let args = copy(a:000)
257+
let path = s:pathsplit(len(args) ? remove(args, 0) : &path)
258+
let suffixes = s:pathsplit(len(args) ? remove(args, 0) : [])
258259
let default = ''
259-
if a:0 > 1 && type(a:2) == type(0)
260-
let index = a:2
261-
elseif a:0 > 1 && type(a:2) == type('')
262-
let default = a:2
260+
if type(get(args, 0)) == type('')
261+
let default = remove(args, 0)
263262
endif
263+
let index = get(args, 0, 1)
264264
let results = []
265265
for glob in path
266266
for dir in s:glob(glob)
267267
let dir = substitute(substitute(dir, '[\/]\=$', '/', ''), '^+\ze\a\a\+:', '', '')
268-
for suf in [''] + (a:name =~# '/$' ? [] : s:pathsplit(get(a:000, 1, [])))
268+
for suf in [''] + (a:name =~# '/$' ? [] : suffixes)
269269
if s:fcall(a:name =~# '/$' ? 'isdirectory' : 'filereadable', dir . a:name . suf)
270270
call add(results, dir . a:name . suf)
271271
endif
@@ -284,7 +284,7 @@ function! s:app_find_file(name, ...) dict abort
284284
else
285285
let path = [self.path()]
286286
endif
287-
return s:find_file(a:name, path, a:0 > 1 ? a:2 : '')
287+
return call('s:find_file', [a:name, path] + a:000[1:-1])
288288
endfunction
289289

290290
call s:add_methods('app',['real','path','spec','root','has_path','has_file','find_file'])

0 commit comments

Comments
 (0)