diff --git a/src/components/config.cpp b/src/components/config.cpp index 6f5bd729..b2d34aaa 100644 --- a/src/components/config.cpp +++ b/src/components/config.cpp @@ -135,7 +135,7 @@ void config::parse_file() { void config::copy_inherited() { for (auto&& section : m_sections) { for (auto&& param : section.second) { - if (param.first.compare(KEY_INHERIT) == 0) { + if (param.first.compare(0, strlen(KEY_INHERIT), KEY_INHERIT) == 0) { // Get name of base section auto inherit = param.second; if ((inherit = dereference(section.first, param.first, inherit, inherit)).empty()) { @@ -154,10 +154,7 @@ void config::copy_inherited() { // that hasn't been defined for the sub-section for (auto&& base_param : base_section->second) { valuemap_t::const_iterator iter; - - if ((iter = section.second.find(base_param.first)) == section.second.end()) { - section.second.emplace_hint(iter, base_param.first, base_param.second); - } + section.second.insert(make_pair(base_param.first, base_param.second)); } } } diff --git a/src/components/controller.cpp b/src/components/controller.cpp index 27df9a4b..0c894d2b 100644 --- a/src/components/controller.cpp +++ b/src/components/controller.cpp @@ -270,8 +270,8 @@ bool controller::on(const sig_ev::process_update& evt) { string separator{bar.separator}; string padding_left(bar.padding.left, ' '); string padding_right(bar.padding.right, ' '); - auto margin_left = bar.module_margin.left; - auto margin_right = bar.module_margin.right; + string margin_left(bar.module_margin.left, ' '); + string margin_right(bar.module_margin.right, ' '); for (const auto& block : m_eventloop->modules()) { string block_contents; @@ -288,25 +288,25 @@ bool controller::on(const sig_ev::process_update& evt) { } for (const auto& module : block.second) { - auto module_contents = module->contents(); + string module_contents{module->contents()}; if (module_contents.empty()) { continue; } - if (!block_contents.empty() && !(is_right && module == block.second.back())) { - block_contents += string(margin_right, ' '); + if (!block_contents.empty() && !margin_right.empty()) { + block_contents += margin_right; } if (!block_contents.empty() && !separator.empty()) { block_contents += separator; } - if (!(is_left && module == block.second.front())) { - block_contents += string(margin_left, ' '); + if (!block_contents.empty() && !margin_left.empty() && !(is_left && module == block.second.front())) { + block_contents += margin_left; } - block_contents += module->contents(); + block_contents += module_contents; } if (block_contents.empty()) {