diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2024-06-23 22:57:24 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2024-06-26 16:39:23 +0000 |
| commit | 963ce45f3f29bccf7ca5aa0dc8e258a11cfbc552 (patch) | |
| tree | a23c8e6d9c3c3ad6048c4b830c0474326b854297 | |
| parent | grid: reflow: handle styled underlines (diff) | |
render: resize: copy styled underlines to temporary grid
When doing an interactive resize, we create a small grid copy of the
current viewport, and then do a non-reflow resize.
When the interactive resize is done, we do a proper reflow. This is
for performance reasons.
When creating the viewport copy, we also need to copy the styled
underlines. Otherwise, styled underlines will be rendered as plain
underlines *while resizing*.
| -rw-r--r-- | render.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -4395,6 +4395,29 @@ render_resize(struct terminal *term, int width, int height, uint8_t opts) memcpy(g.rows[i]->cells, orig->rows[j]->cells, g.num_cols * sizeof(g.rows[i]->cells[0])); + + if (orig->rows[j]->extra == NULL || + orig->rows[j]->extra->curly_ranges.count == 0) + { + continue; + } + + /* + * Copy undercurly ranges + */ + + const struct row_ranges *curly_src = &orig->rows[j]->extra->curly_ranges; + + const int count = curly_src->count; + g.rows[i]->extra = xcalloc(1, sizeof(*g.rows[i]->extra)); + g.rows[i]->extra->curly_ranges.v = xmalloc( + count * sizeof(g.rows[i]->extra->curly_ranges.v[0])); + + struct row_ranges *curly_dst = &g.rows[i]->extra->curly_ranges; + curly_dst->count = curly_dst->size = count; + + for (int k = 0; k < count; k++) + curly_dst->v[k] = curly_src->v[k]; } term->normal = g; |
