Added ModuleLoad hook that uses the module name as the parameter
This commit is contained in:
parent
c3f694a28f
commit
7866d88131
|
@ -65,6 +65,8 @@ void CommandManager::load_module(StringView module_name, Context& context)
|
||||||
module->value.loaded = true;
|
module->value.loaded = true;
|
||||||
execute(module->value.commands, context);
|
execute(module->value.commands, context);
|
||||||
module->value.commands.clear();
|
module->value.commands.clear();
|
||||||
|
|
||||||
|
context.hooks().run_hook(Hook::ModuleLoad, module_name, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct parse_error : runtime_error
|
struct parse_error : runtime_error
|
||||||
|
|
|
@ -57,12 +57,13 @@ enum class Hook
|
||||||
WinCreate,
|
WinCreate,
|
||||||
WinDisplay,
|
WinDisplay,
|
||||||
WinResize,
|
WinResize,
|
||||||
WinSetOption
|
WinSetOption,
|
||||||
|
ModuleLoad
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr auto enum_desc(Meta::Type<Hook>)
|
constexpr auto enum_desc(Meta::Type<Hook>)
|
||||||
{
|
{
|
||||||
return make_array<EnumDesc<Hook>, 41>({
|
return make_array<EnumDesc<Hook>, 42>({
|
||||||
{Hook::BufCreate, "BufCreate"},
|
{Hook::BufCreate, "BufCreate"},
|
||||||
{Hook::BufNewFile, "BufNewFile"},
|
{Hook::BufNewFile, "BufNewFile"},
|
||||||
{Hook::BufOpenFile, "BufOpenFile"},
|
{Hook::BufOpenFile, "BufOpenFile"},
|
||||||
|
@ -104,6 +105,7 @@ constexpr auto enum_desc(Meta::Type<Hook>)
|
||||||
{Hook::WinDisplay, "WinDisplay"},
|
{Hook::WinDisplay, "WinDisplay"},
|
||||||
{Hook::WinResize, "WinResize"},
|
{Hook::WinResize, "WinResize"},
|
||||||
{Hook::WinSetOption, "WinSetOption"},
|
{Hook::WinSetOption, "WinSetOption"},
|
||||||
|
{Hook::ModuleLoad, "ModuleLoad"}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user