Fixes a bug in a previous patch of mine, command_line_shell_completion.patch- .txt, reported by Yegappan Lakshmanan (yegappanl at gmail dot com) on the Vim development list, August 19, 2007. The report: I am running Vim 7.1.82 on Linux and see the following issue: $ cd vim7/src $ vim :edit *unix* When I press to complete the name of files containing the string "unix" in them, it completes all the files in the current directory. It appears the specified pattern is ignored. Unfortunately, my patch caused wildcards to treated as white space, effectively removing them before passing on the completion pattern. This patch fixes the problem by adding the function vim_isfilec_or_wc() and using it instead of vim_isfilec(). Created by Martin Toft during Google Summer of Code 2007. Index: src/proto/charset.pro =================================================================== RCS file: /cvsroot/vim/vim7/src/proto/charset.pro,v retrieving revision 1.12 diff -c -r1.12 charset.pro *** src/proto/charset.pro 5 May 2007 17:21:32 -0000 1.12 --- src/proto/charset.pro 19 Aug 2007 19:58:42 -0000 *************** *** 21,26 **** --- 21,27 ---- int vim_iswordp __ARGS((char_u *p)); int vim_iswordc_buf __ARGS((char_u *p, buf_T *buf)); int vim_isfilec __ARGS((int c)); + int vim_isfilec_or_wc __ARGS((int c)); int vim_isprintc __ARGS((int c)); int vim_isprintc_strict __ARGS((int c)); int lbr_chartabsize __ARGS((unsigned char *s, colnr_T col)); Index: src/charset.c =================================================================== RCS file: /cvsroot/vim/vim7/src/charset.c,v retrieving revision 1.26 diff -c -r1.26 charset.c *** src/charset.c 15 Aug 2007 18:41:26 -0000 1.26 --- src/charset.c 19 Aug 2007 19:58:43 -0000 *************** *** 932,937 **** --- 932,954 ---- } /* + * return TRUE if 'c' is a valid file-name character or a wildcard character + * Assume characters above 0x100 are valid (multi-byte). + * Explicitly interpret ']' as a wildcard character as mch_has_wildcard("]") + * returns false. + */ + int + vim_isfilec_or_wc(c) + int c; + { + char_u buf[2]; + + buf[0] = (char_u)c; + buf[1] = NUL; + return vim_isfilec(c) || c == ']' || mch_has_wildcard(buf); + } + + /* * return TRUE if 'c' is a printable character * Assume characters above 0x100 are printable (multi-byte), except for * Unicode. Index: src/ex_docmd.c =================================================================== RCS file: /cvsroot/vim/vim7/src/ex_docmd.c,v retrieving revision 1.131 diff -c -r1.131 ex_docmd.c *** src/ex_docmd.c 18 Aug 2007 15:47:10 -0000 1.131 --- src/ex_docmd.c 19 Aug 2007 19:58:46 -0000 *************** *** 3311,3319 **** in_quote = !in_quote; } #ifdef SPACE_IN_FILENAME ! else if (!vim_isfilec(c) && (!(ea.argt & NOSPC) || usefilter)) #else ! else if (!vim_isfilec(c)) #endif { while (*p != NUL) --- 3311,3320 ---- in_quote = !in_quote; } #ifdef SPACE_IN_FILENAME ! else if (!vim_isfilec_or_wc(c) ! && (!(ea.argt & NOSPC) || usefilter)) #else ! else if (!vim_isfilec_or_wc(c)) #endif { while (*p != NUL) *************** *** 3324,3330 **** else #endif c = *p; ! if (c == '`' || vim_isfilec(c)) break; #ifdef FEAT_MBYTE if (has_mbyte) --- 3325,3331 ---- else #endif c = *p; ! if (c == '`' || vim_isfilec_or_wc(c)) break; #ifdef FEAT_MBYTE if (has_mbyte)