diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-10-30 14:00:42 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-10-30 14:04:57 +0000 |
| commit | e38ba6ce3d62c2629ebdaad41258d5e4b48f5296 (patch) | |
| tree | 609ef5d7df44e7222ab961634b7c81c97102881a /src/context.cc | |
| parent | 8649371ff23df34c0bf6ca34c1d8b61d7482821e (diff) | |
Add scope class and encapsulate Options, Keymaps, Aliases and Hooks in it
Diffstat (limited to 'src/context.cc')
| -rw-r--r-- | src/context.cc | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src/context.cc b/src/context.cc index 883df5ee..4c72c2bf 100644 --- a/src/context.cc +++ b/src/context.cc @@ -54,40 +54,33 @@ UserInterface& Context::ui() const return client().ui(); } -OptionManager& Context::options() const +Scope& Context::scope() const { if (has_window()) - return window().options(); + return window(); if (has_buffer()) - return buffer().options(); - return GlobalOptions::instance(); + return buffer(); + return GlobalScope::instance(); +} + +OptionManager& Context::options() const +{ + return scope().options(); } HookManager& Context::hooks() const { - if (has_window()) - return window().hooks(); - if (has_buffer()) - return buffer().hooks(); - return GlobalHooks::instance(); + return scope().hooks(); } KeymapManager& Context::keymaps() const { - if (has_window()) - return window().keymaps(); - if (has_buffer()) - return buffer().keymaps(); - return GlobalKeymaps::instance(); + return scope().keymaps(); } AliasRegistry& Context::aliases() const { - if (has_window()) - return window().aliases(); - if (has_buffer()) - return buffer().aliases(); - return GlobalAliases::instance(); + return scope().aliases(); } void Context::set_client(Client& client) |
