version 1.284, 2020/05/16 15:38:14 |
version 1.285, 2020/05/16 15:49:20 |
|
|
u_int *cy, int trim) |
u_int *cy, int trim) |
{ |
{ |
struct screen *dst; |
struct screen *dst; |
u_int sy; |
|
const struct grid_line *gl; |
const struct grid_line *gl; |
|
u_int sy, wx, wy; |
|
int reflow; |
|
|
dst = xcalloc(1, sizeof *dst); |
dst = xcalloc(1, sizeof *dst); |
|
|
|
|
screen_size_x(src), sy, screen_size_x(hint), |
screen_size_x(src), sy, screen_size_x(hint), |
screen_hsize(src) + screen_size_y(src)); |
screen_hsize(src) + screen_size_y(src)); |
screen_init(dst, screen_size_x(src), sy, screen_hlimit(src)); |
screen_init(dst, screen_size_x(src), sy, screen_hlimit(src)); |
|
|
|
/* |
|
* Ensure history is on for the backing grid so lines are not deleted |
|
* during resizing. |
|
*/ |
|
dst->grid->flags |= GRID_HISTORY; |
grid_duplicate_lines(dst->grid, 0, src->grid, 0, sy); |
grid_duplicate_lines(dst->grid, 0, src->grid, 0, sy); |
|
|
dst->grid->sy = sy - screen_hsize(src); |
dst->grid->sy = sy - screen_hsize(src); |
|
|
dst->cy = src->cy; |
dst->cy = src->cy; |
} |
} |
|
|
|
if (cx != NULL && cy != NULL) { |
|
*cx = dst->cx; |
|
*cy = screen_hsize(dst) + dst->cy; |
|
reflow = (screen_size_x(hint) != screen_size_x(dst)); |
|
} |
|
else |
|
reflow = 0; |
|
if (reflow) |
|
grid_wrap_position(dst->grid, *cx, *cy, &wx, &wy); |
screen_resize_cursor(dst, screen_size_x(hint), screen_size_y(hint), 1, |
screen_resize_cursor(dst, screen_size_x(hint), screen_size_y(hint), 1, |
0, cx, cy); |
0, 0); |
|
if (reflow) |
|
grid_unwrap_position(dst->grid, cx, cy, wx, wy); |
|
|
return (dst); |
return (dst); |
} |
} |
|
|
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); |
wme->swp != wme->wp); |
|
|
|
data->cx = cx; |
if (cy < screen_hsize(data->backing)) { |
if (cy < screen_hsize(data->backing)) { |
data->cx = cx; |
|
data->cy = 0; |
data->cy = 0; |
data->oy = screen_hsize(data->backing) - cy; |
data->oy = screen_hsize(data->backing) - cy; |
} else { |
} else { |
data->cx = data->backing->cx; |
data->cy = cy - screen_hsize(data->backing); |
data->cy = data->backing->cy; |
|
data->oy = 0; |
data->oy = 0; |
} |
} |
|
|
|
|
{ |
{ |
struct window_copy_mode_data *data = wme->data; |
struct window_copy_mode_data *data = wme->data; |
struct screen *s = &data->screen; |
struct screen *s = &data->screen; |
|
struct grid *gd = data->backing->grid; |
|
u_int cx, cy, wx, wy; |
|
int reflow; |
|
|
screen_resize(s, sx, sy, 0); |
screen_resize(s, sx, sy, 0); |
screen_resize_cursor(data->backing, sx, sy, 1, 0, NULL, NULL); |
cx = data->cx; |
|
cy = gd->hsize + data->cy - data->oy; |
|
reflow = (gd->sx != sx); |
|
if (reflow) |
|
grid_wrap_position(gd, cx, cy, &wx, &wy); |
|
screen_resize_cursor(data->backing, sx, sy, 1, 0, 0); |
|
if (reflow) |
|
grid_unwrap_position(gd, &cx, &cy, wx, wy); |
|
|
if (data->cy > sy - 1) |
data->cx = cx; |
data->cy = sy - 1; |
if (cy < gd->hsize) { |
if (data->cx > sx) |
data->cy = 0; |
data->cx = sx; |
data->oy = gd->hsize - cy; |
if (data->oy > screen_hsize(data->backing)) |
} else { |
data->oy = screen_hsize(data->backing); |
data->cy = cy - gd->hsize; |
|
data->oy = 0; |
|
} |
|
|
window_copy_size_changed(wme); |
window_copy_size_changed(wme); |
window_copy_redraw_screen(wme); |
window_copy_redraw_screen(wme); |