aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-08-04 16:07:54 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-08-04 16:07:54 +0000
commitc07d14e1c095ac36b4a85ce5bc88f6ba15a4ad8d (patch)
treec633885876359f0b903825d0c03a4ee8f16107bf /grid.c
parentinput: disable debug loggin (diff)
grid: reflow: don't insert <width> spacer cells for *every* empty cell
Only do it for the last, non-empty cell.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/grid.c b/grid.c
index 4ccb27ac..4486393b 100644
--- a/grid.c
+++ b/grid.c
@@ -261,14 +261,15 @@ grid_reflow(struct grid *grid, int new_rows, int new_cols,
}
}
new_col_idx++;
+ }
- /* For multi-column characters, insert spacers in the
- * subsequent cells */
- for (size_t i = 0; i < width - 1; i++) {
- assert(new_col_idx < new_cols);
- print_spacer();
- new_col_idx++;
- }
+ /* For multi-column characters, insert spacers in the
+ * subsequent cells */
+ const struct cell *old_cell = &old_row->cells[c];
+ for (size_t i = 0; i < width - 1; i++) {
+ assert(new_col_idx < new_cols);
+ print_spacer();
+ new_col_idx++;
}
c += width - 1;