1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-26 04:52:53 +03:00
kakoune/src/scope.cc
Maxime Coste f75d49e9ef Do not include non-primitive option value in *SetOption hook filter
Only include the value for int/str/bool options, for the rest just
write '<option name>=...'.

This should reduce the cost of some patterns such as repeatedly adding
a value inside a list option.

It seems very unlikely that the actual value would be matched by
a hook regex string for non primitive types.
2020-06-09 21:38:47 +10:00

27 lines
525 B
C++

#include "scope.hh"
#include "context.hh"
namespace Kakoune
{
GlobalScope::GlobalScope()
: m_option_registry(m_options)
{
options().register_watcher(*this);
}
GlobalScope::~GlobalScope()
{
options().unregister_watcher(*this);
}
void GlobalScope::on_option_changed(const Option& option)
{
Context empty_context{Context::EmptyContextFlag{}};
hooks().run_hook(Hook::GlobalSetOption,
format("{}={}", option.name(), option.get_desc_string()),
empty_context);
}
}