mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-02 01:40:13 -05:00
commit
ba48109a9b
6 changed files with 44 additions and 8 deletions
18
render.c
18
render.c
|
|
@ -2638,10 +2638,20 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
|
|||
assert(new_rows >= 1);
|
||||
|
||||
/* Margins */
|
||||
term->margins.left = pad_x;
|
||||
term->margins.top = pad_y;
|
||||
term->margins.right = term->width - new_cols * term->cell_width - term->margins.left;
|
||||
term->margins.bottom = term->height - new_rows * term->cell_height - term->margins.top;
|
||||
const int grid_width = new_cols * term->cell_width;
|
||||
const int grid_height = new_rows * term->cell_height;
|
||||
const int total_x_pad = term->width - grid_width;
|
||||
const int total_y_pad = term->height - grid_height;
|
||||
|
||||
if (term->conf->center) {
|
||||
term->margins.left = total_x_pad / 2;
|
||||
term->margins.top = total_y_pad / 2;
|
||||
} else {
|
||||
term->margins.left = pad_x;
|
||||
term->margins.top = pad_y;
|
||||
}
|
||||
term->margins.right = total_x_pad - term->margins.left;
|
||||
term->margins.bottom = total_y_pad - term->margins.top;
|
||||
|
||||
assert(term->margins.left >= pad_x);
|
||||
assert(term->margins.right >= pad_x);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue