diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-02-14 18:03:33 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-02-14 18:03:33 +0000 |
| commit | 60056fdd6121d8b63aad01b1d891bd554bf880f7 (patch) | |
| tree | 861b8c34c5a04b311882d957eda468a26c2526e3 /render.c | |
| parent | render: reflow: erase row when wrapping around the scrollback (diff) | |
render: resize: don't reflow text if grid layout hasn't changed
A window resize doesn't necessarily mean the grid layout changes. When
it doesn't, don't reflow text.
This fixes a slowness issue on Sway, when swapping positions of two
~equally sized windows.
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1130,6 +1130,11 @@ maybe_resize(struct terminal *term, int width, int height, bool force) term->x_margin = (term->width - new_cols * term->cell_width) / 2; term->y_margin = (term->height - new_rows * term->cell_height) / 2; + if (old_rows == new_rows && old_cols == new_cols) { + /* Skip reflow if grid layout hasn't changed */ + goto done; + } + /* Allocate new 'normal' and 'alt' grids */ struct row **normal = calloc(new_normal_grid_rows, sizeof(normal[0])); struct row **alt = calloc(new_alt_grid_rows, sizeof(alt[0])); @@ -1250,6 +1255,8 @@ maybe_resize(struct terminal *term, int width, int height, bool force) term->render.last_cursor.cell = NULL; tll_free(term->normal.scroll_damage); tll_free(term->alt.scroll_damage); + +done: term->render.last_buf = NULL; term_damage_view(term); render_refresh(term); |
