comparison src/cmdexpand.c @ 25684:ba9d587f0b29 v8.2.3378

patch 8.2.3378: MS-Windows: completing environment variables with % is wrong Commit: https://github.com/vim/vim/commit/6024c0427ce1196344439997d5e41a6f8546368c Author: Albert Liu <albertymliu@gmail.com> Date: Fri Aug 27 20:59:35 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Fri, 27 Aug 2021 21:00:04 +0200
parents 17ba70005a2e
children 2eddbc3d83b9
comparison
equal deleted inserted replaced
25683:7be599085162 25684:ba9d587f0b29
1275 // When still after the command name expand executables. 1275 // When still after the command name expand executables.
1276 if (xp->xp_pattern == skipwhite(arg)) 1276 if (xp->xp_pattern == skipwhite(arg))
1277 xp->xp_context = EXPAND_SHELLCMD; 1277 xp->xp_context = EXPAND_SHELLCMD;
1278 } 1278 }
1279 1279
1280 // Check for environment variable 1280 // Check for environment variable.
1281 if (*xp->xp_pattern == '$' 1281 if (*xp->xp_pattern == '$')
1282 #if defined(MSWIN)
1283 || *xp->xp_pattern == '%'
1284 #endif
1285 )
1286 { 1282 {
1287 for (p = xp->xp_pattern + 1; *p != NUL; ++p) 1283 for (p = xp->xp_pattern + 1; *p != NUL; ++p)
1288 if (!vim_isIDc(*p)) 1284 if (!vim_isIDc(*p))
1289 break; 1285 break;
1290 if (*p == NUL) 1286 if (*p == NUL)
1294 // Avoid that the assignment uses EXPAND_FILES again. 1290 // Avoid that the assignment uses EXPAND_FILES again.
1295 if (compl != EXPAND_USER_DEFINED && compl != EXPAND_USER_LIST) 1291 if (compl != EXPAND_USER_DEFINED && compl != EXPAND_USER_LIST)
1296 compl = EXPAND_ENV_VARS; 1292 compl = EXPAND_ENV_VARS;
1297 } 1293 }
1298 } 1294 }
1299 // Check for user names 1295 // Check for user names.
1300 if (*xp->xp_pattern == '~') 1296 if (*xp->xp_pattern == '~')
1301 { 1297 {
1302 for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p) 1298 for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p)
1303 ; 1299 ;
1304 // Complete ~user only if it partially matches a user name. 1300 // Complete ~user only if it partially matches a user name.