mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(api): include event in get_autocmds (#17553)
This commit is contained in:
parent
01139ec82c
commit
37a86a2f96
@ -197,6 +197,10 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
|
|||||||
"pattern",
|
"pattern",
|
||||||
STRING_OBJ(cstr_to_string((char *)ap->pat)));
|
STRING_OBJ(cstr_to_string((char *)ap->pat)));
|
||||||
|
|
||||||
|
PUT(autocmd_info,
|
||||||
|
"event",
|
||||||
|
STRING_OBJ(cstr_to_string((char *)event_nr2name(event))));
|
||||||
|
|
||||||
PUT(autocmd_info, "once", BOOLEAN_OBJ(ac->once));
|
PUT(autocmd_info, "once", BOOLEAN_OBJ(ac->once));
|
||||||
|
|
||||||
if (ap->buflocal_nr) {
|
if (ap->buflocal_nr) {
|
||||||
|
@ -598,7 +598,7 @@ event_T event_name2nr(const char_u *start, char_u **end)
|
|||||||
/// @param[in] event Event to return name for.
|
/// @param[in] event Event to return name for.
|
||||||
///
|
///
|
||||||
/// @return Event name, static string. Returns "Unknown" for unknown events.
|
/// @return Event name, static string. Returns "Unknown" for unknown events.
|
||||||
static const char *event_nr2name(event_T event)
|
const char *event_nr2name(event_T event)
|
||||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_CONST
|
FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_CONST
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -217,6 +217,14 @@ describe('autocmd api', function()
|
|||||||
eq(1, #new_aus)
|
eq(1, #new_aus)
|
||||||
eq(first, new_aus[1])
|
eq(first, new_aus[1])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('should return event name', function()
|
||||||
|
command [[au! InsertEnter]]
|
||||||
|
command [[au InsertEnter * :echo "1"]]
|
||||||
|
|
||||||
|
local aus = meths.get_autocmds { event = "InsertEnter" }
|
||||||
|
eq({ { buflocal = false, command = ':echo "1"', event = "InsertEnter", once = false, pattern = "*" } }, aus)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('groups', function()
|
describe('groups', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user