summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Drouhard <john@drouhard.dev>2022-08-01 11:38:17 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-01 11:38:17 +0100
commit95fca12b0e8a351ce4416417323db24c63eb940a (patch)
tree5458560bbf1fa58bd52f89d47db65c4f6e2a2691 /src
parent84b247fab70e9b76539c2a0e24556e7c66126974 (diff)
downloadvim-git-95fca12b0e8a351ce4416417323db24c63eb940a.tar.gz
patch 9.0.0126: expanding file names fails in dir with more than 255 entriesv9.0.0126
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)
Diffstat (limited to 'src')
-rw-r--r--src/findfile.c2
-rw-r--r--src/testdir/test_gf.vim25
-rw-r--r--src/version.c2
3 files changed, 27 insertions, 2 deletions
diff --git a/src/findfile.c b/src/findfile.c
index 12e76b444..881eef156 100644
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -75,7 +75,7 @@ typedef struct ff_stack
// of wc_part
char_u **ffs_filearray;
int ffs_filearray_size;
- char_u ffs_filearray_cur; // needed for partly handled dirs
+ int ffs_filearray_cur; // needed for partly handled dirs
// to store status of partly handled directories
// 0: we work on this directory for the first time
diff --git a/src/testdir/test_gf.vim b/src/testdir/test_gf.vim
index 1b3b13981..04228b2c1 100644
--- a/src/testdir/test_gf.vim
+++ b/src/testdir/test_gf.vim
@@ -138,7 +138,7 @@ func Test_gf_visual()
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 @@ func Test_includeexpr_scriptlocal_func()
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
diff --git a/src/version.c b/src/version.c
index 4d45122bd..3dfd3d964 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 126,
+/**/
125,
/**/
124,