grid: reflow: don't insert <width> spacer cells for *every* empty cell

Only do it for the last, non-empty cell.
This commit is contained in:
Daniel Eklöf 2020-08-04 18:07:54 +02:00
parent 32a155fbf4
commit c07d14e1c0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 10 additions and 7 deletions

15
grid.c
View file

@ -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;