From c114afadbd5444cb3b783b161970aaa942416974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 13 Feb 2024 16:28:03 +0100 Subject: [PATCH] render: always center grid when fullscreened or maximized --- CHANGELOG.md | 2 ++ render.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a11e2b5b..c8d9d781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/render.c b/render.c index f82e54f0..c6fedfbe 100644 --- a/render.c +++ b/render.c @@ -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 {