respect bracket paddings

This commit is contained in:
Felix Kratz 2023-04-05 19:58:09 +02:00
parent d8c11b653b
commit 44cb73e94a

View file

@ -251,17 +251,28 @@ static void bar_calculate_bounds_top_bottom(struct bar* bar) {
next_position = &bar_center_left_first_item_x, rtl = true; next_position = &bar_center_left_first_item_x, rtl = true;
else continue; else continue;
int group_padding_left = 0;
int group_padding_right = 0;
if (bar_item->group && (bar_item->group->first_item == bar_item))
group_padding_left = bar_item->group->members[0]->background.padding_left;
if (bar_item->group && (bar_item->group->last_item == bar_item))
group_padding_right = bar_item->group->members[0]->background.padding_right;
if (bar_item->position == POSITION_RIGHT if (bar_item->position == POSITION_RIGHT
|| bar_item->position == POSITION_CENTER_LEFT) { || bar_item->position == POSITION_CENTER_LEFT) {
*next_position = min(*next_position - bar_item_display_length *next_position = min(*next_position - bar_item_display_length
- bar_item->background.padding_right, - bar_item->background.padding_right
- group_padding_right,
bar->window.frame.size.width bar->window.frame.size.width
- bar_item_display_length ); - bar_item_display_length );
} }
else { else {
*next_position += max((int)-*next_position, *next_position += max((int)-*next_position,
bar_item->background.padding_left); bar_item->background.padding_left
+ group_padding_left );
} }
bar_item->graph.rtl = rtl; bar_item->graph.rtl = rtl;
@ -291,14 +302,18 @@ static void bar_calculate_bounds_top_bottom(struct bar* bar) {
*next_position += bar_item->has_const_width *next_position += bar_item->has_const_width
? bar_item_display_length ? bar_item_display_length
+ bar_item->background.padding_right + bar_item->background.padding_right
+ group_padding_right
- bar_item->custom_width - bar_item->custom_width
: - bar_item->background.padding_left; : (- bar_item->background.padding_left
- group_padding_left );
} else { } else {
*next_position += bar_item->has_const_width *next_position += bar_item->has_const_width
? bar_item->custom_width ? bar_item->custom_width
- bar_item->background.padding_left - bar_item->background.padding_left
- group_padding_left
: (bar_item_length : (bar_item_length
+ bar_item->background.padding_right); + bar_item->background.padding_right
+ group_padding_right );
} }
} }