1
0
forked from aniani/vim

patch 8.2.3378: MS-Windows: completing environment variables with % is wrong

Problem:    MS-Windows: completing environment variables with % is wrong.
Solution:   Only complete environment variables with $. (Albert Liu,
            closes #8791)
This commit is contained in:
Albert Liu
2021-08-27 20:59:35 +02:00
committed by Bram Moolenaar
parent 47016f5772
commit 6024c0427c
3 changed files with 9 additions and 7 deletions

View File

@@ -1277,12 +1277,8 @@ set_one_cmd_context(
xp->xp_context = EXPAND_SHELLCMD; xp->xp_context = EXPAND_SHELLCMD;
} }
// Check for environment variable // Check for environment variable.
if (*xp->xp_pattern == '$' if (*xp->xp_pattern == '$')
#if defined(MSWIN)
|| *xp->xp_pattern == '%'
#endif
)
{ {
for (p = xp->xp_pattern + 1; *p != NUL; ++p) for (p = xp->xp_pattern + 1; *p != NUL; ++p)
if (!vim_isIDc(*p)) if (!vim_isIDc(*p))
@@ -1296,7 +1292,7 @@ set_one_cmd_context(
compl = EXPAND_ENV_VARS; compl = EXPAND_ENV_VARS;
} }
} }
// Check for user names // Check for user names.
if (*xp->xp_pattern == '~') if (*xp->xp_pattern == '~')
{ {
for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p) for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p)

View File

@@ -9,6 +9,10 @@ func Test_complete_tab()
call writefile(['testfile'], 'Xtestfile') call writefile(['testfile'], 'Xtestfile')
call feedkeys(":e Xtest\t\r", "tx") call feedkeys(":e Xtest\t\r", "tx")
call assert_equal('testfile', getline(1)) 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') call delete('Xtestfile')
endfunc endfunc

View File

@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3378,
/**/ /**/
3377, 3377,
/**/ /**/