diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-04-17 20:18:02 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-04-17 20:20:27 +0000 |
| commit | 7eb990c8b15ca765dce1762ff6fd359a8c5e66b1 (patch) | |
| tree | 4d4aebf62bccd4ef56cb19d1289055bc7c3de705 /render.c | |
| parent | grid: reflow: make tracking_points array 'const' (diff) | |
render: resize: need to translate selection coordinates
While it *looked* like the selection was working before, it really
wasn't.
When rendering, we're looking at the cells' attributes to determine
whether they have been selected or not.
When copying text however, we use the terminal's 'selection' state,
which consists of 'start' and 'end' coordinates.
These need to be translated when reflowing text.
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -25,6 +25,7 @@ #define TIME_FRAME_RENDERING 0 #define TIME_SCROLL_DAMAGE 0 +#define ALEN(v) (sizeof(v) / sizeof(v[0])) #define min(x, y) ((x) < (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y)) @@ -1751,9 +1752,21 @@ maybe_resize(struct terminal *term, int width, int height, bool force) goto damage_view; } + struct coord *const tracking_points[] = { + &term->selection.start, + &term->selection.end, + }; + /* Reflow grids */ - grid_reflow(&term->normal, new_normal_grid_rows, new_cols, old_rows, new_rows, 0, NULL); - grid_reflow(&term->alt, new_alt_grid_rows, new_cols, old_rows, new_rows, 0, NULL); + grid_reflow( + &term->normal, new_normal_grid_rows, new_cols, old_rows, new_rows, + term->grid == &term->normal ? ALEN(tracking_points) : 0, + term->grid == &term->normal ? tracking_points : NULL); + + grid_reflow( + &term->alt, new_alt_grid_rows, new_cols, old_rows, new_rows, + term->grid == &term->alt ? ALEN(tracking_points) : 0, + term->grid == &term->alt ? tracking_points : NULL); /* Reset tab stops */ tll_free(term->tab_stops); |
