diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-04-28 19:09:03 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-28 19:09:03 +0100 |
commit | 211a5bb2353c66684f38527184a258921f95c9d9 (patch) | |
tree | 72c3147098eebf1720061ebd8fa3996b7eeb50fb /src/ex_docmd.c | |
parent | a96edb736d4274fc4aea460800780e06e1510812 (diff) | |
download | vim-git-211a5bb2353c66684f38527184a258921f95c9d9.tar.gz |
patch 8.2.4842: expand("%:p") is not empty when there is no buffer namev8.2.4842
Problem: expand("%:p") is not empty when there is no buffer name.
Solution: When ignoring errors still return NULL. (closes #10311)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 226435003..f78e4edf2 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -9349,12 +9349,15 @@ eval_vars( } } - if (empty_is_error && (resultlen == 0 || valid != VALID_HEAD + VALID_PATH)) + if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH) { - if (valid != VALID_HEAD + VALID_PATH) - *errormsg = _(e_empty_file_name_for_percent_or_hash_only_works_with_ph); - else - *errormsg = _(e_evaluates_to_an_empty_string); + if (empty_is_error) + { + if (valid != VALID_HEAD + VALID_PATH) + *errormsg = _(e_empty_file_name_for_percent_or_hash_only_works_with_ph); + else + *errormsg = _(e_evaluates_to_an_empty_string); + } result = NULL; } else |