fix(controller): Module margin require surrounding text
This commit is contained in:
parent
cdec06ee5a
commit
e11798253a
@ -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<string>(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user