mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 10:18:18 +00:00
fix(autocmd): API functions accept garbage after event name #25523
"VimEnter foo" was accepted as a valid event name for "VimEnter". Events delimited with commas, eg. "VimEnter,BufRead", were also accepted, even though only the first event was actually parsed. Co-authored-by: ii14 <ii14@users.noreply.github.com>
This commit is contained in:
@@ -33,13 +33,11 @@
|
||||
// Copy string or array of strings into an empty array.
|
||||
// Get the event number, unless it is an error. Then goto `goto_name`.
|
||||
#define GET_ONE_EVENT(event_nr, event_str, goto_name) \
|
||||
char *__next_ev; \
|
||||
event_T event_nr = \
|
||||
event_name2nr(event_str.data.string.data, &__next_ev); \
|
||||
if (event_nr >= NUM_EVENTS) { \
|
||||
api_set_error(err, kErrorTypeValidation, "unexpected event"); \
|
||||
event_name2nr_str(event_str.data.string); \
|
||||
VALIDATE_S((event_nr < NUM_EVENTS), "event", event_str.data.string.data, { \
|
||||
goto goto_name; \
|
||||
}
|
||||
});
|
||||
|
||||
// ID for associating autocmds created via nvim_create_autocmd
|
||||
// Used to delete autocmds from nvim_del_autocmd
|
||||
|
Reference in New Issue
Block a user