diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-07-19 11:38:14 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-19 11:38:14 -0400 |
| commit | d1b3a9924d6d0e77cdd1196efbbf2b57e9946ea0 (patch) | |
| tree | c587a049122919d083ae1e3ef49321638493156c /test/functional/vimscript/executable_spec.lua | |
| parent | 746f5682a7d7c8e5cb122da5d68eacfd55d58887 (diff) | |
| download | rneovim-d1b3a9924d6d0e77cdd1196efbbf2b57e9946ea0.tar.gz rneovim-d1b3a9924d6d0e77cdd1196efbbf2b57e9946ea0.tar.bz2 rneovim-d1b3a9924d6d0e77cdd1196efbbf2b57e9946ea0.zip | |
feat(api): mark nvim_create_autocmd as api-fast #40836
Problem:
nvim_create_autocmd() isn't |api-fast|, so modules that create autocmds
(e.g. vim.treesitter.query) can't be require()d in a fast event context.
Solution:
Mark it |api-fast|. Compile autocmd patterns with RE_NOBREAK so
aucmd_next() won't os_breakcheck() mid-iteration, where a fast
nvim_create_autocmd() could realloc the autocmds vector and dangle the
caller's AutoPat/AutoCmd.
RE_NOBREAK is low-risk because:
- aucmd_next()'s loop checks CTRL-C: `(for (… i < apc->ausize && !got_int; …)`.
- `line_breakcheck()` (`autocmd.c:1912`) runs once per matched autocmd.
- Each autocmd _execution_ runs through `do_cmdline`, which has its own
breakchecks.
However this does admit risk of a pathological case:
a catastrophic-backtracking glob matched against a very long `User`
event-pattern.
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'test/functional/vimscript/executable_spec.lua')
0 files changed, 0 insertions, 0 deletions