diff options
author | watiko <service@mail.watiko.net> | 2016-02-12 16:29:05 +0900 |
---|---|---|
committer | watiko <service@mail.watiko.net> | 2016-02-21 22:06:23 +0900 |
commit | c8561ecf268c498b41eb36c18f3eda1557b7bdc1 (patch) | |
tree | 99c560a5e8ede3ac76f8e7da4321627affab272d | |
parent | fc51f86b727bb3bd8e65b8a0bab0548a90582269 (diff) | |
download | rneovim-c8561ecf268c498b41eb36c18f3eda1557b7bdc1.tar.gz rneovim-c8561ecf268c498b41eb36c18f3eda1557b7bdc1.tar.bz2 rneovim-c8561ecf268c498b41eb36c18f3eda1557b7bdc1.zip |
vim-patch:7.4.831
Problem: When expanding `=expr` on the command line and encountering an
error, the command is executed anyway.
Solution: Bail out when an error is detected.
https://github.com/vim/vim/commit/3f188935ec4db5117c4a64cc3f71219175624745
-rw-r--r-- | src/nvim/path.c | 30 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index e0e5f19911..75b34339dd 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1117,6 +1117,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u *p; static bool recursive = false; int add_pat; + bool retval = OK; bool did_expand_in_path = false; /* @@ -1158,12 +1159,13 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, add_pat = -1; p = pat[i]; - if (vim_backtick(p)) + if (vim_backtick(p)) { add_pat = expand_backtick(&ga, p, flags); - else { - /* - * First expand environment variables, "~/" and "~user/". - */ + if (add_pat == -1) { + retval = FAIL; + } + } else { + // First expand environment variables, "~/" and "~user/". if (has_env_var(p) || *p == '~') { p = expand_env_save_opt(p, true); if (p == NULL) @@ -1234,7 +1236,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, recursive = false; - return (ga.ga_data != NULL) ? OK : FAIL; + return (ga.ga_data != NULL) ? retval : FAIL; } @@ -1246,13 +1248,10 @@ static int vim_backtick(char_u *p) return *p == '`' && *(p + 1) != NUL && *(p + STRLEN(p) - 1) == '`'; } -/* - * Expand an item in `backticks` by executing it as a command. - * Currently only works when pat[] starts and ends with a `. - * Returns number of file names found. - */ -static int -expand_backtick ( +// Expand an item in `backticks` by executing it as a command. +// Currently only works when pat[] starts and ends with a `. +// Returns number of file names found, -1 if an error is encountered. +static int expand_backtick( garray_T *gap, char_u *pat, int flags /* EW_* flags */ @@ -1273,8 +1272,9 @@ expand_backtick ( buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0, NULL); xfree(cmd); - if (buffer == NULL) - return 0; + if (buffer == NULL) { + return -1; + } cmd = buffer; while (*cmd != NUL) { diff --git a/src/nvim/version.c b/src/nvim/version.c index 7d4b8982cd..6fdad105e4 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -459,7 +459,7 @@ static int included_patches[] = { 834, 833, // 832, - // 831, + 831, 830, // 829 NA 828, |