diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-04-20 08:01:31 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-04-20 08:01:31 +0100 |
commit | b1be668a3ecdd5a7956728db1a54477e237d08b5 (patch) | |
tree | b08dcd9317f912f455958d715e4cbaec1a2b0ba5 /window-copy.c | |
parent | 8c9bbc37495b31f3decaeaa38d21bd42121bcd70 (diff) | |
parent | b846ec266571be41e84ebda4480484db73416c81 (diff) | |
download | rtmux-b1be668a3ecdd5a7956728db1a54477e237d08b5.tar.gz rtmux-b1be668a3ecdd5a7956728db1a54477e237d08b5.tar.bz2 rtmux-b1be668a3ecdd5a7956728db1a54477e237d08b5.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/window-copy.c b/window-copy.c index 45a47675..2bda5d56 100644 --- a/window-copy.c +++ b/window-copy.c @@ -299,7 +299,7 @@ window_copy_scroll_timer(__unused int fd, __unused short events, void *arg) static struct screen * window_copy_clone_screen(struct screen *src, struct screen *hint, u_int *cx, - u_int *cy) + u_int *cy, int trim) { struct screen *dst; u_int sy; @@ -308,11 +308,13 @@ window_copy_clone_screen(struct screen *src, struct screen *hint, u_int *cx, dst = xcalloc(1, sizeof *dst); sy = screen_hsize(src) + screen_size_y(src); - while (sy > screen_hsize(src)) { - gl = grid_peek_line(src->grid, sy - 1); - if (gl->cellused != 0) - break; - sy--; + if (trim) { + while (sy > screen_hsize(src)) { + gl = grid_peek_line(src->grid, sy - 1); + if (gl->cellused != 0) + break; + sy--; + } } log_debug("%s: target screen is %ux%u, source %ux%u", __func__, screen_size_x(src), sy, screen_size_x(hint), @@ -386,7 +388,8 @@ window_copy_init(struct window_mode_entry *wme, u_int i, cx, cy; data = window_copy_common_init(wme); - data->backing = window_copy_clone_screen(base, &data->screen, &cx, &cy); + data->backing = window_copy_clone_screen(base, &data->screen, &cx, &cy, + wme->swp != wme->wp); if (cy < screen_hsize(data->backing)) { data->cx = cx; @@ -2042,7 +2045,7 @@ window_copy_cmd_refresh_from_pane(struct window_copy_cmd_state *cs) screen_free(data->backing); free(data->backing); data->backing = window_copy_clone_screen(&wp->base, &data->screen, NULL, - NULL); + NULL, wme->swp != wme->wp); window_copy_size_changed(wme); return (WINDOW_COPY_CMD_REDRAW); |