patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Problem: Expanding file names fails in directory with more than 255
entries.
Solution: Use an int instead of char_u to count. (John Drouhard,
closes #10818)
diff --git a/src/testdir/test_gf.vim b/src/testdir/test_gf.vim
index 1b3b139..04228b2 100644
--- a/src/testdir/test_gf.vim
+++ b/src/testdir/test_gf.vim
@@ -138,7 +138,7 @@
call assert_equal('Xtest_gf_visual', bufname('%'))
call assert_equal(3, getcurpos()[1])
- " do not include the NUL at the end
+ " do not include the NUL at the end
call writefile(['x'], 'X')
let save_enc = &enc
for enc in ['latin1', 'utf-8']
@@ -250,4 +250,27 @@
bw!
endfunc
+" Check that expanding directories can handle more than 255 entries.
+func Test_gf_subdirs_wildcard()
+ let cwd = getcwd()
+ let dir = 'Xtestgf_dir'
+ call mkdir(dir)
+ call chdir(dir)
+ for i in range(300)
+ call mkdir(i)
+ call writefile([], i .. '/' .. i, 'S')
+ endfor
+ set path=./**
+
+ new | only
+ call setline(1, '99')
+ w! Xtest1
+ normal gf
+ call assert_equal('99', fnamemodify(bufname(''), ":t"))
+
+ call chdir(cwd)
+ call delete(dir, 'rf')
+ set path&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab