mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 12:49:11 +00:00
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>