aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCelina Sophie Kalus <hello@celinakalus.de>2026-09-08 20:19:05 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-09-10 06:35:29 +0000
commitd4896e386b3757264775e3ac2e1d1abc9d13a0c2 (patch)
tree133c9ece2dc39c6544679181018071ea015f8b5a
parentserver: fix use-after-free during shutdown (diff)
grid: reflow: Preserve cells with background color
A cell was previously considered empty if its content is empty. When an empty cell has a non-default background color, truncating such cells from the end of the line when reflowing is unexpected. Instead, treat such cells as non-empty to preserve them. Closes #2462 Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
-rw-r--r--CHANGELOG.md8
-rw-r--r--grid.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39eab318..e60ffeaf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -74,6 +74,14 @@
## Unreleased
### Added
### Changed
+
+* Cells with a non-default background colors, but otherwise empty, are
+ now preserved (not removed) when resizing a terminal window
+ ([#2462][2462]).
+
+[2462]: https://codeberg.org/dnkl/foot/issues/2462
+
+
### Deprecated
### Removed
### Fixed
diff --git a/grid.c b/grid.c
index df7ef61c..459bf8f5 100644
--- a/grid.c
+++ b/grid.c
@@ -927,7 +927,7 @@ grid_resize_and_reflow(
int col_count = 0;
for (int c = old_cols - 1; c >= 0; c--) {
const struct cell *cell = &old_row->cells[c];
- if (!(cell->wc == 0 || cell->wc == CELL_SPACER)) {
+ if (!(cell->wc == 0 || cell->wc == CELL_SPACER) || cell->attrs.bg_src != COLOR_DEFAULT) {
col_count = c + 1;
break;
}