diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-05-28 15:41:47 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-06-02 18:13:51 +0000 |
| commit | 5a08ed641b39fcd84373ac120ecfb2d11f9987b9 (patch) | |
| tree | 2d89d7674f7bc585804a2f986670a0a7c1aafe33 | |
| parent | grid: reflow: check the *entire* row for non-empty cells (diff) | |
grid: reflow: when determining row end coord, check *last* tracking point
| -rw-r--r-- | grid.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -535,9 +535,17 @@ grid_resize_and_reflow( /* Do we have a (at least one) tracking point on this row */ struct coord *tp; - if ((*next_tp)->row == old_row_idx) { + if (unlikely((*next_tp)->row == old_row_idx)) { tp = *next_tp; - col_count = max(col_count, tp->col + 1); + + /* Find the *last* tracking point on this row */ + struct coord *last_on_row = tp; + for (struct coord **iter = next_tp; (*iter)->row == old_row_idx; iter++) + last_on_row = *iter; + + /* And make sure its end point is included in the col range */ + xassert(last_on_row->row == old_row_idx); + col_count = max(col_count, last_on_row->col + 1); } else tp = NULL; |
