aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-23 13:31:07 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-23 17:48:12 +0800
commitd459b6687704b7d1f230d0b14c0d59f87cf5f67d (patch)
treed65ac06e9560138c20f09d6f8269b4d9e2d29713 /src/nvim/ex_docmd.c
parentf1b8683b8c2f4a48d501c9dedef664f17761b8ac (diff)
downloadrneovim-d459b6687704b7d1f230d0b14c0d59f87cf5f67d.tar.gz
rneovim-d459b6687704b7d1f230d0b14c0d59f87cf5f67d.tar.bz2
rneovim-d459b6687704b7d1f230d0b14c0d59f87cf5f67d.zip
vim-patch:8.2.4842: expand("%:p") is not empty when there is no buffer name
Problem: expand("%:p") is not empty when there is no buffer name. Solution: When ignoring errors still return NULL. (closes vim/vim#10311) https://github.com/vim/vim/commit/211a5bb2353c66684f38527184a258921f95c9d9
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index f9055a0e8b..e8860ff0d4 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6891,12 +6891,14 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
}
}
- if (empty_is_error && (resultlen == 0 || valid != VALID_HEAD + VALID_PATH)) {
- if (valid != VALID_HEAD + VALID_PATH) {
- // xgettext:no-c-format
- *errormsg = _("E499: Empty file name for '%' or '#', only works with \":p:h\"");
- } else {
- *errormsg = _("E500: Evaluates to an empty string");
+ if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH) {
+ if (empty_is_error) {
+ if (valid != VALID_HEAD + VALID_PATH) {
+ // xgettext:no-c-format
+ *errormsg = _("E499: Empty file name for '%' or '#', only works with \":p:h\"");
+ } else {
+ *errormsg = _("E500: Evaluates to an empty string");
+ }
}
result = NULL;
} else {