On Wed, Aug 4, 2010 at 4:47 PM, Nazri Ramliy <ayieh...@gmail.com> wrote: > On Wed, Aug 4, 2010 at 1:16 PM, Nazri Ramliy <ayieh...@gmail.com> wrote: >> which call expand_in_path(), which in turns call globpath(), fails with >> the exact same argument "c:/src/vim/**", "misc*" and 0 for path, file and >> expand_options, respectively. >> >> Help! > > I think I found the solution. "recursive" should be reset to FALSE before > calling expand_in_path in gen_expand_wildcards(). > > I'll submit a patch soon.
Patch attached (0001). > > I'm also working on a test script to test the find completion stuff. > > I'll send a patch for that one too, soon. > Preliminary patch attached (0002). It only test for relative path with '**' notation. Obviously there should be more path values that it should test but I gotta run now and I think that having a preliminary test is much better than having no test at all. This one runs fine on unix. I'm also attaching a third patch (0003) that (BLINDLY) adds test73.out to the other platforms. It is added here so that others can try it out. nazri. -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
From 99bfc4658184e10a01db239bba8e91da42b580b2 Mon Sep 17 00:00:00 2001 From: Nazri Ramliy <ayieh...@gmail.com> Date: Wed, 4 Aug 2010 17:16:17 +0800 Subject: [PATCH 1/3] find completion: use globpath for both windows and unix --- src/misc1.c | 22 +++------------------- 1 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/misc1.c b/src/misc1.c index b0f7e91..99b021d 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -9578,14 +9578,10 @@ expand_in_path(gap, pattern, flags) char_u *curdir; garray_T path_ga; int i; -# ifdef WIN3264 - char_u *file_pattern; -# else char_u *files = NULL; char_u *s; /* start */ char_u *e; /* end */ char_u *paths = NULL; -# endif if ((curdir = alloc((unsigned)MAXPATHL)) == NULL) return 0; @@ -9594,20 +9590,6 @@ expand_in_path(gap, pattern, flags) expand_path_option(curdir, &path_ga); vim_free(curdir); path_list = (char_u **)(path_ga.ga_data); -# ifdef WIN3264 - if ((file_pattern = alloc((unsigned)MAXPATHL)) == NULL) - return 0; - for (i = 0; i < path_ga.ga_len; i++) - { - if (STRLEN(path_list[i]) + STRLEN(pattern) + 2 > MAXPATHL) - continue; - STRCPY(file_pattern, path_list[i]); - STRCAT(file_pattern, "/"); - STRCAT(file_pattern, pattern); - mch_expandpath(gap, file_pattern, EW_DIR|EW_ADDSLASH|EW_FILE); - } - vim_free(file_pattern); -# else for (i = 0; i < path_ga.ga_len; i++) { if (paths == NULL) @@ -9654,7 +9636,6 @@ expand_in_path(gap, pattern, flags) } vim_free(files); -# endif return gap->ga_len; } @@ -9795,7 +9776,10 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) { #if defined(FEAT_SEARCHPATH) if (*p != '.' && !vim_ispathsep(*p) && (flags & EW_PATH)) + { + recursive = FALSE; add_pat = expand_in_path(&ga, p, flags); + } else #endif add_pat = mch_expandpath(&ga, p, flags); -- 1.7.2.1.6.g61bf12
From 4be95b821c6542c5c69932e8fa90ad4416af498a Mon Sep 17 00:00:00 2001 From: Nazri Ramliy <ayieh...@gmail.com> Date: Wed, 4 Aug 2010 10:38:25 +0800 Subject: [PATCH 2/3] Test script for testing find completion --- src/testdir/Makefile | 2 +- src/testdir/test73.in | 18 ++++++++++++++++++ src/testdir/test73.ok | 3 +++ 3 files changed, 22 insertions(+), 1 deletions(-) create mode 100644 src/testdir/test73.in create mode 100644 src/testdir/test73.ok diff --git a/src/testdir/Makefile b/src/testdir/Makefile index f970b26..4951dc2 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -23,7 +23,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test54.out test55.out test56.out test57.out test58.out \ test59.out test60.out test61.out test62.out test63.out \ test64.out test65.out test66.out test67.out test68.out \ - test69.out test70.out test71.out test72.out + test69.out test70.out test71.out test72.out test73.out SCRIPTS_GUI = test16.out diff --git a/src/testdir/test73.in b/src/testdir/test73.in new file mode 100644 index 0000000..ca8750c --- /dev/null +++ b/src/testdir/test73.in @@ -0,0 +1,18 @@ +Tests for find completion. + +STARTTEST +:!mkdir -p Xfind/in/path +:!echo Holy Grail > Xfind/file.txt +:!echo Jimmy Hoffa > Xfind/in/file.txt +:!echo E.T. > Xfind/in/path/file.txt +:set path=Xfind/** +:set nocp +:find file +:w! test.out +:find file +:w >>test.out +:find file +:w >>test.out +:qa! +ENDTEST + diff --git a/src/testdir/test73.ok b/src/testdir/test73.ok new file mode 100644 index 0000000..bf1d433 --- /dev/null +++ b/src/testdir/test73.ok @@ -0,0 +1,3 @@ +Holy Grail +Jimmy Hoffa +E.T. -- 1.7.2.1.6.g61bf12
From 054274787c07e6bb0dc03bc9ca628ea8f7bd49b8 Mon Sep 17 00:00:00 2001 From: Nazri Ramliy <ayieh...@gmail.com> Date: Wed, 4 Aug 2010 17:21:24 +0800 Subject: [PATCH 3/3] Add find completion test to amiga, dos, ming, os2, and vms makefiles --- src/testdir/Make_amiga.mak | 2 +- src/testdir/Make_dos.mak | 2 +- src/testdir/Make_ming.mak | 2 +- src/testdir/Make_os2.mak | 2 +- src/testdir/Make_vms.mms | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 59c616d..5374a69 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -27,7 +27,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test56.out test57.out test58.out test59.out test60.out \ test61.out test62.out test63.out test64.out test65.out \ test66.out test67.out test68.out test69.out test70.out \ - test71.out test72.out + test71.out test72.out test73.out .SUFFIXES: .in .out diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 063fd85..94b44c2 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -27,7 +27,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test30.out test31.out test32.out test33.out test34.out \ test37.out test38.out test39.out test40.out test41.out \ test42.out test52.out test65.out test66.out test67.out \ - test68.out test69.out test71.out test72.out + test68.out test69.out test71.out test72.out test73.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 9029d98..d115684 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -47,7 +47,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test30.out test31.out test32.out test33.out test34.out \ test37.out test38.out test39.out test40.out test41.out \ test42.out test52.out test65.out test66.out test67.out \ - test68.out test69.out test71.out test72.out + test68.out test69.out test71.out test72.out test73.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index f5262e2..46e9b6c 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -27,7 +27,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test56.out test57.out test58.out test59.out test60.out \ test61.out test62.out test63.out test64.out test65.out \ test66.out test67.out test68.out test69.out test70.out \ - test71.out test72.out + test71.out test72.out test73.out .SUFFIXES: .in .out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 6ea02de..96be987 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -74,7 +74,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test56.out test57.out test60.out \ test61.out test62.out test63.out test64.out test65.out \ test66.out test67.out test68.out test69.out \ - test71.out test72.out + test71.out test72.out test73.out # Known problems: # Test 30: a problem around mac format - unknown reason -- 1.7.2.1.6.g61bf12