From c07d14e1c095ac36b4a85ce5bc88f6ba15a4ad8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 4 Aug 2020 18:07:54 +0200 Subject: [PATCH] grid: reflow: don't insert spacer cells for *every* empty cell Only do it for the last, non-empty cell. --- CHANGELOG.md | 2 ++ grid.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae73f58f..12566d45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,8 @@ * Command lines for **pipe-visible** and **pipe-scrollback** are now tokenized (i.e. syntax checked) when the configuration is loaded, instead of every time the key binding is executed. +* Incorrect multi-column character spacer insertion when reflowing + text. ### Security 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;