]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0416: Unix: filename completion splits at space for single-file Ex commands v9.2.0416
authorMaxim Kim <habamax@gmail.com>
Wed, 29 Apr 2026 17:14:11 +0000 (17:14 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 29 Apr 2026 17:19:35 +0000 (17:19 +0000)
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 <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/todo.txt
runtime/doc/version9.txt
src/cmdexpand.c
src/os_amiga.h
src/os_dos.h
src/os_mac.h
src/os_vms_conf.h
src/testdir/test_cmdline.vim
src/version.c

index beddbea4c2462cd4c8223baddb2565a266c87bbc..34dacefd6efe2e9910efeaebcc3b8c73b0207bea 100644 (file)
@@ -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.
 
index 6b8d97b41a49c91870637c805a4a5daccebc90b3..f3bea36e1f9fbbedc23f21cbf8e47a861fe3a51d 100644 (file)
@@ -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 ~
index 2a8bd31b23488bcf9b02c589caaf3a88970e7a94..9dfb6979c0435325cb4fb43c038c5a2db7b851b9 100644 (file)
@@ -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'
index 14076137445fd4a28ea220056fdc76521f8edc5a..257972012b18ba2ed6dfa46c5a1bdd0180c9420b 100644 (file)
@@ -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
index f53434824e487fd3641fbc8dc9a160a620e5efe8..72a876755f10d44ebe34b673793bca15240008f8 100644 (file)
 #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()
index f171d7ccf6842b66eae3791449da3251507de32d..7716e63aeb09bcb560118c16295ed07f0a32fd5c 100644 (file)
@@ -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"
index 5831cb1f7475ec1bb72b0e885741264a711215dc..37be6ddfc6c3a177783500e7a0cb7a9158d93111 100644 (file)
@@ -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
index 270f1ddbcbe967aeccf44358913600dc4ef562a9..8a170894c7cfe892af44007b52822f94932d6f89 100644 (file)
@@ -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
index c54177a4a9b4ac6ac49e71d8446c21fa18537fb8..e4607baba5af0c1d991258080ec777feefcc4811 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    416,
 /**/
     415,
 /**/