aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-02-06 13:03:33 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-02-06 13:03:33 +0000
commitd84b0d4c6a75b9856045bb49d00e05ea10f77755 (patch)
treeb6c76c69263f37c467be60c2b256f05727d4c12b /grid.c
parentterm: insert-mode: handle combining characters correctly (diff)
parentchangelog: text-sizing protocol (diff)
Merge branch 'text-width-protocol'
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/grid.c b/grid.c
index b7c0447c..2dc4fcd5 100644
--- a/grid.c
+++ b/grid.c
@@ -1052,16 +1052,16 @@ grid_resize_and_reflow(
*/
while (
unlikely(
- amount > 1 &&
+ amount > 0 &&
from + amount < old_cols &&
old_row->cells[from + amount].wc >= CELL_SPACER + 1))
{
+ spacers = old_row->cells[from + amount].wc - CELL_SPACER + 1;
amount--;
- spacers++;
}
xassert(
- amount == 1 ||
+ amount <= 1 ||
old_row->cells[from + amount - 1].wc <= CELL_SPACER + 1);
}
@@ -1084,11 +1084,9 @@ grid_resize_and_reflow(
if (unlikely(spacers > 0)) {
xassert(new_col_idx + spacers == new_cols);
- const struct cell *cell = &old_row->cells[from - 1];
-
for (int i = 0; i < spacers; i++, new_col_idx++) {
new_row->cells[new_col_idx].wc = CELL_SPACER;
- new_row->cells[new_col_idx].attrs = cell->attrs;
+ new_row->cells[new_col_idx].attrs = (struct attributes){0};
}
}
}