render: always center grid when fullscreened or maximized

This commit is contained in:
Daniel Eklöf 2024-02-13 16:28:03 +01:00
parent fa01bf2b75
commit c114afadbd
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 7 additions and 1 deletions

View file

@ -83,6 +83,8 @@
* `smm` now disables private mode 1036 (_"send ESC when Meta modifies
a key"_), and enables private mode 1034 (_"8-bit Meta mode"_). `rmm`
does the opposite ([#1584][1584]).
* Grid is now always centered in the window, when either fullscreened
or maximized.
[1526]: https://codeberg.org/dnkl/foot/issues/1526
[1528]: https://codeberg.org/dnkl/foot/issues/1528

View file

@ -4060,7 +4060,11 @@ render_resize(struct terminal *term, int width, int height, uint8_t opts)
const int total_x_pad = term->width - grid_width;
const int total_y_pad = term->height - grid_height;
if (term->conf->center && !term->window->is_resizing) {
const bool centered_padding = term->conf->center
|| term->window->is_fullscreen
|| term->window->is_maximized;
if (centered_padding && !term->window->is_resizing) {
term->margins.left = total_x_pad / 2;
term->margins.top = total_y_pad / 2;
} else {