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

View file

@ -51,6 +51,8 @@
* Command lines for **pipe-visible** and **pipe-scrollback** are now * Command lines for **pipe-visible** and **pipe-scrollback** are now
tokenized (i.e. syntax checked) when the configuration is loaded, tokenized (i.e. syntax checked) when the configuration is loaded,
instead of every time the key binding is executed. instead of every time the key binding is executed.
* Incorrect multi-column character spacer insertion when reflowing
text.
### Security ### Security

15
grid.c
View file

@ -261,14 +261,15 @@ grid_reflow(struct grid *grid, int new_rows, int new_cols,
} }
} }
new_col_idx++; new_col_idx++;
}
/* For multi-column characters, insert spacers in the /* For multi-column characters, insert spacers in the
* subsequent cells */ * subsequent cells */
for (size_t i = 0; i < width - 1; i++) { const struct cell *old_cell = &old_row->cells[c];
assert(new_col_idx < new_cols); for (size_t i = 0; i < width - 1; i++) {
print_spacer(); assert(new_col_idx < new_cols);
new_col_idx++; print_spacer();
} new_col_idx++;
} }
c += width - 1; c += width - 1;