aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/autocmd.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-08-03 00:08:17 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-08-03 00:08:17 -0600
commit9449e1b8d273ff78eb894c588110ffa0c17d6ee3 (patch)
tree9e4470c33bd4187d9f42f0b2c4aaa995310c5be8 /src/nvim/autocmd.c
parent308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (diff)
parentb8dcbcc732baf84fc48d6b272c3ade0bcb129b3b (diff)
downloadrneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.tar.gz
rneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.tar.bz2
rneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.zip
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'src/nvim/autocmd.c')
-rw-r--r--src/nvim/autocmd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index d51079b515..2b4c9c5b9c 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -14,10 +14,12 @@
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/eval/userfunc.h"
+#include "nvim/eval/vars.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/getchar.h"
+#include "nvim/insexpand.h"
#include "nvim/lua/executor.h"
#include "nvim/map.h"
#include "nvim/option.h"
@@ -1835,9 +1837,13 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
}
ap->last = true;
+ // Make sure cursor and topline are valid. The first time the current
+ // values are saved, restored by reset_lnums(). When nested only the
+ // values are corrected when needed.
if (nesting == 1) {
- // make sure cursor and topline are valid
check_lnums(true);
+ } else {
+ check_lnums_nested(true);
}
// Execute the autocmd. The `getnextac` callback handles iteration.
@@ -2051,8 +2057,8 @@ static bool call_autocmd_callback(const AutoCmd *ac, const AutoPatCmd *apc)
break;
}
- FIXED_TEMP_ARRAY(args, 1);
- args.items[0] = DICTIONARY_OBJ(data);
+ MAXSIZE_TEMP_ARRAY(args, 1);
+ ADD_C(args, DICTIONARY_OBJ(data));
Object result = nlua_call_ref(callback.data.luaref, NULL, args, true, NULL);
if (result.type == kObjectTypeBoolean) {