Patch 8.2.3378

9 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 27, 2021, 3:00:31 PM8/27/21
to vim...@googlegroups.com

Patch 8.2.3378
Problem: MS-Windows: completing environment variables with % is wrong.
Solution: Only complete environment variables with $. (Albert Liu,
closes #8791)
Files: src/cmdexpand.c, src/testdir/test_cmdline.vim


*** ../vim-8.2.3377/src/cmdexpand.c 2021-08-26 16:39:55.710406651 +0200
--- src/cmdexpand.c 2021-08-27 20:57:54.866135012 +0200
***************
*** 1277,1288 ****
xp->xp_context = EXPAND_SHELLCMD;
}

! // Check for environment variable
! if (*xp->xp_pattern == '$'
! #if defined(MSWIN)
! || *xp->xp_pattern == '%'
! #endif
! )
{
for (p = xp->xp_pattern + 1; *p != NUL; ++p)
if (!vim_isIDc(*p))
--- 1277,1284 ----
xp->xp_context = EXPAND_SHELLCMD;
}

! // Check for environment variable.
! if (*xp->xp_pattern == '$')
{
for (p = xp->xp_pattern + 1; *p != NUL; ++p)
if (!vim_isIDc(*p))
***************
*** 1296,1302 ****
compl = EXPAND_ENV_VARS;
}
}
! // Check for user names
if (*xp->xp_pattern == '~')
{
for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p)
--- 1292,1298 ----
compl = EXPAND_ENV_VARS;
}
}
! // Check for user names.
if (*xp->xp_pattern == '~')
{
for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p)
*** ../vim-8.2.3377/src/testdir/test_cmdline.vim 2021-08-26 16:39:55.710406651 +0200
--- src/testdir/test_cmdline.vim 2021-08-27 20:58:54.909947997 +0200
***************
*** 9,14 ****
--- 9,18 ----
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

*** ../vim-8.2.3377/src/version.c 2021-08-26 16:39:55.710406651 +0200
--- src/version.c 2021-08-27 20:57:02.626299923 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3378,
/**/

--
Why I like vim:
> I like VIM because, when I ask a question in this newsgroup, I get a
> one-line answer. With xemacs, I get a 1Kb lisp script with bugs in it ;-)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages