mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-18 17:02:06 +03:00
When creating an Option, OptionManager takes it's initial value from it's parent if possible
This commit is contained in:
parent
bc359d7c90
commit
cab03ef1c6
@ -10,10 +10,23 @@ Option& OptionManager::operator[] (const String& name)
|
||||
auto it = m_options.find(name);
|
||||
if (it != m_options.end())
|
||||
return it->second;
|
||||
else if (m_parent)
|
||||
return (*m_parent)[name];
|
||||
else
|
||||
return m_options[name];
|
||||
{
|
||||
Option& res = m_options[name];
|
||||
OptionManager* parent = m_parent;
|
||||
while (parent)
|
||||
{
|
||||
auto parent_it = parent->m_options.find(name);
|
||||
if (parent_it != parent->m_options.end())
|
||||
{
|
||||
res = parent_it->second;
|
||||
break;
|
||||
}
|
||||
else
|
||||
parent = parent->m_parent;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
const Option& OptionManager::operator[] (const String& name) const
|
||||
|
Loading…
Reference in New Issue
Block a user