patch 9.2.0416: Unix: filename completion splits at space for single-file Ex commands
Commit:
https://github.com/vim/vim/commit/c2bda0add96a18328299e9fe6d75925049a5146a
Author: Maxim Kim <
hab...@gmail.com>
Date: Wed Apr 29 17:14:11 2026 +0000
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 <
hab...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index beddbea4c..34dacefd6 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 6b8d97b41..f3bea36e1 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 2a8bd31b2..9dfb6979c 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 == '
' || 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 140761374..257972012 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 f53434824..72a876755 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 f171d7ccf..7716e63ae 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 5831cb1f7..37be6ddfc 100644
--- a/src/os_vms_conf.h
+++ b/src/os_vms_conf.h
@@ -12,7 +12,6 @@
#include <decc$types.h> // 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 270f1ddbc..8a170894c 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\<C-A>\<C-B>\"\<CR>", '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 c54177a4a..e4607baba 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,
/**/