mirror of
https://github.com/neovim/neovim.git
synced 2025-10-25 20:07:09 +00:00
Merge pull request #4247 from watiko/vim-7.4.903
vim-patch:7.4.{831,832,845,903}
This commit is contained in:
@@ -262,8 +262,25 @@ void expand_env_esc(char_u *srcp, char_u *dst, int dstlen, bool esc, bool one,
|
|||||||
startstr_len = (int)STRLEN(startstr);
|
startstr_len = (int)STRLEN(startstr);
|
||||||
|
|
||||||
src = skipwhite(srcp);
|
src = skipwhite(srcp);
|
||||||
--dstlen; // leave one char space for "\,"
|
dstlen--; // leave one char space for "\,"
|
||||||
while (*src && dstlen > 0) {
|
while (*src && dstlen > 0) {
|
||||||
|
// Skip over `=expr`.
|
||||||
|
if (src[0] == '`' && src[1] == '=') {
|
||||||
|
var = src;
|
||||||
|
src += 2;
|
||||||
|
(void)skip_expr(&src);
|
||||||
|
if (*src == '`') {
|
||||||
|
src++;
|
||||||
|
}
|
||||||
|
size_t len = (size_t)(src - var);
|
||||||
|
if (len > (size_t)dstlen) {
|
||||||
|
len = (size_t)dstlen;
|
||||||
|
}
|
||||||
|
memcpy((char *)dst, (char *)var, len);
|
||||||
|
dst += len;
|
||||||
|
dstlen -= (int)len;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
copy_char = true;
|
copy_char = true;
|
||||||
if ((*src == '$') || (*src == '~' && at_start)) {
|
if ((*src == '$') || (*src == '~' && at_start)) {
|
||||||
mustfree = false;
|
mustfree = false;
|
||||||
|
|||||||
@@ -556,8 +556,9 @@ static size_t do_path_expand(garray_T *gap, const char_u *path,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make room for file name */
|
// Make room for file name. When doing encoding conversion the actual
|
||||||
buf = xmalloc(STRLEN(path) + BASENAMELEN + 5);
|
// length may be quite a bit longer, thus use the maximum possible length.
|
||||||
|
buf = xmalloc(MAXPATHL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the first part in the path name that contains a wildcard.
|
* Find the first part in the path name that contains a wildcard.
|
||||||
@@ -1158,12 +1159,17 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
|||||||
add_pat = -1;
|
add_pat = -1;
|
||||||
p = pat[i];
|
p = pat[i];
|
||||||
|
|
||||||
if (vim_backtick(p))
|
if (vim_backtick(p)) {
|
||||||
add_pat = expand_backtick(&ga, p, flags);
|
add_pat = expand_backtick(&ga, p, flags);
|
||||||
else {
|
if (add_pat == -1) {
|
||||||
/*
|
recursive = false;
|
||||||
* First expand environment variables, "~/" and "~user/".
|
FreeWild(ga.ga_len, (char_u **)ga.ga_data);
|
||||||
*/
|
*num_file = 0;
|
||||||
|
*file = NULL;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// First expand environment variables, "~/" and "~user/".
|
||||||
if (has_env_var(p) || *p == '~') {
|
if (has_env_var(p) || *p == '~') {
|
||||||
p = expand_env_save_opt(p, true);
|
p = expand_env_save_opt(p, true);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
@@ -1246,13 +1252,10 @@ static int vim_backtick(char_u *p)
|
|||||||
return *p == '`' && *(p + 1) != NUL && *(p + STRLEN(p) - 1) == '`';
|
return *p == '`' && *(p + 1) != NUL && *(p + STRLEN(p) - 1) == '`';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Expand an item in `backticks` by executing it as a command.
|
||||||
* Expand an item in `backticks` by executing it as a command.
|
// Currently only works when pat[] starts and ends with a `.
|
||||||
* Currently only works when pat[] starts and ends with a `.
|
// Returns number of file names found, -1 if an error is encountered.
|
||||||
* Returns number of file names found.
|
static int expand_backtick(
|
||||||
*/
|
|
||||||
static int
|
|
||||||
expand_backtick (
|
|
||||||
garray_T *gap,
|
garray_T *gap,
|
||||||
char_u *pat,
|
char_u *pat,
|
||||||
int flags /* EW_* flags */
|
int flags /* EW_* flags */
|
||||||
@@ -1273,8 +1276,9 @@ expand_backtick (
|
|||||||
buffer = get_cmd_output(cmd, NULL,
|
buffer = get_cmd_output(cmd, NULL,
|
||||||
(flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
|
(flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
|
||||||
xfree(cmd);
|
xfree(cmd);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL) {
|
||||||
return 0;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
cmd = buffer;
|
cmd = buffer;
|
||||||
while (*cmd != NUL) {
|
while (*cmd != NUL) {
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ static int included_patches[] = {
|
|||||||
// 906 NA
|
// 906 NA
|
||||||
// 905,
|
// 905,
|
||||||
// 904,
|
// 904,
|
||||||
// 903,
|
903,
|
||||||
// 902 NA
|
// 902 NA
|
||||||
// 901,
|
// 901,
|
||||||
// 900 NA
|
// 900 NA
|
||||||
@@ -445,7 +445,7 @@ static int included_patches[] = {
|
|||||||
848,
|
848,
|
||||||
847,
|
847,
|
||||||
// 846 NA
|
// 846 NA
|
||||||
// 845,
|
845,
|
||||||
844,
|
844,
|
||||||
843,
|
843,
|
||||||
// 842 NA
|
// 842 NA
|
||||||
@@ -458,8 +458,8 @@ static int included_patches[] = {
|
|||||||
835,
|
835,
|
||||||
834,
|
834,
|
||||||
833,
|
833,
|
||||||
// 832,
|
832,
|
||||||
// 831,
|
831,
|
||||||
830,
|
830,
|
||||||
// 829 NA
|
// 829 NA
|
||||||
828,
|
828,
|
||||||
|
|||||||
Reference in New Issue
Block a user