aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-07 10:17:19 +0800
committerGitHub <noreply@github.com>2023-06-07 10:17:19 +0800
commitfcaf0d5f3824431520a0b6353c771107cc63ed4e (patch)
tree3c4cd503d1e881b68feaa5c235906f6f9ca7949b /src/nvim/ex_docmd.c
parent0e0a166a0cc5a2dc199136e313e58c27bfb91977 (diff)
parentdd24ea819507e3a5da04df55df7dda5240e5b57f (diff)
downloadrneovim-fcaf0d5f3824431520a0b6353c771107cc63ed4e.tar.gz
rneovim-fcaf0d5f3824431520a0b6353c771107cc63ed4e.tar.bz2
rneovim-fcaf0d5f3824431520a0b6353c771107cc63ed4e.zip
Merge pull request #23943 from zeertzjq/autocmd-fname
fix(events): don't expand non-file as file name
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 19ee1d841b..9ea9f28fa5 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6899,12 +6899,10 @@ char *eval_vars(char *src, const char *srcstart, size_t *usedlen, linenr_T *lnum
break;
case SPEC_AFILE: // file name for autocommand
- if (autocmd_fname != NULL
- && !path_is_absolute(autocmd_fname)
- // For CmdlineEnter and related events, <afile> is not a path! #9348
- && !strequal("/", autocmd_fname)) {
+ if (autocmd_fname != NULL && !autocmd_fname_full) {
// Still need to turn the fname into a full path. It was
// postponed to avoid a delay when <afile> is not used.
+ autocmd_fname_full = true;
result = FullName_save(autocmd_fname, false);
// Copy into `autocmd_fname`, don't reassign it. #8165
xstrlcpy(autocmd_fname, result, MAXPATHL);