From c2bda0add96a18328299e9fe6d75925049a5146a Mon Sep 17 00:00:00 2001 From: Maxim Kim Date: Wed, 29 Apr 2026 17:14:11 +0000 Subject: [PATCH] patch 9.2.0416: Unix: filename completion splits at space for single-file Ex commands Problem: SPACE_IN_FILENAME is defined on most platforms but not on Unix. As a result, set_context_for_wildcard_arg() on Unix always resets the completion pattern at white space for Ex commands that take a single file argument. Solution: Drop the SPACE_IN_FILENAME ifdef (Maxim Kim) fixes: #18411 closes: #20090 Signed-off-by: Maxim Kim Signed-off-by: Christian Brabandt --- runtime/doc/todo.txt | 4 +--- runtime/doc/version9.txt | 3 +++ src/cmdexpand.c | 2 -- src/os_amiga.h | 1 - src/os_dos.h | 1 - src/os_mac.h | 1 - src/os_vms_conf.h | 1 - src/testdir/test_cmdline.vim | 16 ++++++++++++++++ src/version.c | 2 ++ 9 files changed, 22 insertions(+), 9 deletions(-) diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index beddbea4c2..34dacefd6e 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 9.2. Last change: 2026 Feb 14 +*todo.txt* For Vim version 9.2. Last change: 2026 Apr 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -421,8 +421,6 @@ more information. Add an option to restrict 'incsearch' to not scroll the view. (Tavis Ormandy) -Remove SPACE_IN_FILENAME ? It is only used for completion. - When 'term' starts with "foot" then default t_TI and t_TE to the values used for the builtin xterm termcap. diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 6b8d97b41a..f3bea36e1f 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -52642,6 +52642,9 @@ Changed ~ - Removed the Wayland focus steal feature 'wlsteal', since it causes too many issues and can now be re-implemted using the |clipboard-providers| feature if needed, see |wayland-primary-selection| for an example. +- On Unix, filename completion for single-file Ex commands now treats embedded + whitespace as part of the filename, like on other platforms. + *added-9.3* Added ~ diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 2a8bd31b23..9dfb6979c0 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -1832,9 +1832,7 @@ set_context_for_wildcard_arg( // An argument can contain just about everything, except // characters that end the command and white space. else if (c == '|' || c == '\n' || c == '"' || (VIM_ISWHITE(c) -#ifdef SPACE_IN_FILENAME && (!(eap != NULL && (eap->argt & EX_NOSPC)) || usefilter) -#endif )) { len = 0; // avoid getting stuck when space is in 'isfname' diff --git a/src/os_amiga.h b/src/os_amiga.h index 1407613744..257972012b 100644 --- a/src/os_amiga.h +++ b/src/os_amiga.h @@ -11,7 +11,6 @@ */ #define CASE_INSENSITIVE_FILENAME // ignore case when comparing file names -#define SPACE_IN_FILENAME #define USE_FNAME_CASE // adjust case of file names #define USE_TERM_CONSOLE #define HAVE_AVAIL_MEM diff --git a/src/os_dos.h b/src/os_dos.h index f53434824e..72a876755f 100644 --- a/src/os_dos.h +++ b/src/os_dos.h @@ -109,7 +109,6 @@ #define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #define CASE_INSENSITIVE_FILENAME // ignore case when comparing file names -#define SPACE_IN_FILENAME #define BACKSLASH_IN_FILENAME #define USE_CRNL // lines end in CR-NL instead of NL #define HAVE_DUP // have dup() diff --git a/src/os_mac.h b/src/os_mac.h index f171d7ccf6..7716e63aeb 100644 --- a/src/os_mac.h +++ b/src/os_mac.h @@ -74,7 +74,6 @@ #define USE_EXE_NAME // to find $VIM #define CASE_INSENSITIVE_FILENAME // ignore case when comparing file names -#define SPACE_IN_FILENAME #define USE_FNAME_CASE // make ":e os_Mac.c" open the file in its // original case, as "os_mac.c" diff --git a/src/os_vms_conf.h b/src/os_vms_conf.h index 5831cb1f74..37be6ddfc6 100644 --- a/src/os_vms_conf.h +++ b/src/os_vms_conf.h @@ -12,7 +12,6 @@ #include // Required early for large-file support #define CASE_INSENSITIVE_FILENAME // Open VMS is case insensitive -#define SPACE_IN_FILENAME // There could be space between user and passwd #define FNAME_ILLEGAL "|*#?%" // Illegal characters in a file name #define BINARY_FILE_IO // Use binary fileio #define USE_GETCWD diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 270f1ddbcb..8a170894c7 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -5400,4 +5400,20 @@ func Test_rulerformat_empty() set rulerformat& endfunc +func Test_cmdline_complete_with_space() + call mkdir('Xspc', 'R') + let save_cwd = getcwd() + cd Xspc + call writefile([], 'foo bar') + call writefile([], 'baz') + call writefile([], 'bz') + + " This should expand to foo\ bar, not add 3 space separated + " files: foo baz bz + call feedkeys(":badd foo b\\\"\", 'xt') + call assert_equal('"badd foo\ bar', @:) + + call chdir(save_cwd) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index c54177a4a9..e4607baba5 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 416, /**/ 415, /**/