summaryrefslogtreecommitdiff
path: root/src/scope.cc
blob: fe33f6f56f2fbdce7898bb683e197ab6c796e189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "scope.hh"
#include "context.hh"

namespace Kakoune
{

void Scope::reparent(Scope& parent)
{
    m_options.reparent(parent.m_options);
    m_hooks.reparent(parent.m_hooks);
    m_keymaps.reparent(parent.m_keymaps);
    m_aliases.reparent(parent.m_aliases);
    m_faces.reparent(parent.m_faces);
    m_highlighters.reparent(parent.m_highlighters);
}

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);
}

}