Add Context::option_manager()
it returns the more specific option manager available (window -> buffer -> global)
This commit is contained in:
parent
9c78453cb7
commit
286462a2f6
|
@ -32,6 +32,16 @@ struct Context
|
|||
return *m_window;
|
||||
}
|
||||
bool has_window() const { return m_window; }
|
||||
|
||||
OptionManager& option_manager() const
|
||||
{
|
||||
if (m_window)
|
||||
return m_window->option_manager();
|
||||
if (m_buffer)
|
||||
return m_buffer->option_manager();
|
||||
return GlobalOptionManager::instance();
|
||||
}
|
||||
|
||||
public:
|
||||
safe_ptr<Window> m_window;
|
||||
safe_ptr<Buffer> m_buffer;
|
||||
|
|
|
@ -440,7 +440,7 @@ int main(int argc, char* argv[])
|
|||
{ return context.window().selections_content().back(); });
|
||||
shell_manager.register_env_var("opt_.+",
|
||||
[](const String& name, const Context& context)
|
||||
{ return context.window().option_manager()[name.substr(4)].as_string(); });
|
||||
{ return context.option_manager()[name.substr(4)].as_string(); });
|
||||
register_commands();
|
||||
register_highlighters();
|
||||
register_filters();
|
||||
|
|
Loading…
Reference in New Issue
Block a user