]> granicus.if.org Git - vim/commitdiff
patch 8.2.3378: MS-Windows: completing environment variables with % is wrong v8.2.3378
authorAlbert Liu <albertymliu@gmail.com>
Fri, 27 Aug 2021 18:59:35 +0000 (20:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 27 Aug 2021 18:59:35 +0000 (20:59 +0200)
Problem:    MS-Windows: completing environment variables with % is wrong.
Solution:   Only complete environment variables with $. (Albert Liu,
            closes #8791)

src/cmdexpand.c
src/testdir/test_cmdline.vim
src/version.c

index 27fda786679bd24e15170981d0ded62e5b8d1ccd..58ba7596755ff4a1c4395b1194eb355db710231d 100644 (file)
@@ -1277,12 +1277,8 @@ set_one_cmd_context(
                xp->xp_context = EXPAND_SHELLCMD;
        }
 
-       // Check for environment variable
-       if (*xp->xp_pattern == '$'
-#if defined(MSWIN)
-               || *xp->xp_pattern == '%'
-#endif
-               )
+       // Check for environment variable.
+       if (*xp->xp_pattern == '$')
        {
            for (p = xp->xp_pattern + 1; *p != NUL; ++p)
                if (!vim_isIDc(*p))
@@ -1296,7 +1292,7 @@ set_one_cmd_context(
                    compl = EXPAND_ENV_VARS;
            }
        }
-       // Check for user names
+       // Check for user names.
        if (*xp->xp_pattern == '~')
        {
            for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p)
index f7f55aa60dc9428425ff3cb96c4d582e35977889..0a71b1118bb0c4f8a048cd7b200fda079509a71a 100644 (file)
@@ -9,6 +9,10 @@ func Test_complete_tab()
   call writefile(['testfile'], 'Xtestfile')
   call feedkeys(":e Xtest\t\r", "tx")
   call assert_equal('testfile', getline(1))
+
+  " Pressing <Tab> after '%' completes the current file, also on MS-Windows
+  call feedkeys(":e %\t\r", "tx")
+  call assert_equal('e Xtestfile', @:)
   call delete('Xtestfile')
 endfunc
 
index 7aa602f8fe89d17a375a1b044f6cf857426b8086..a3f0a8db200030bfe670f6932e2455d4c3353c39 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3378,
 /**/
     3377,
 /**/