Wrap when copy mode is used for output, from Balazs Kezes.

This commit is contained in:
nicm 2014-11-06 10:56:44 +00:00
parent e4bf1e5128
commit 7445d303e0

View File

@ -239,7 +239,6 @@ window_copy_init_for_output(struct window_pane *wp)
data->backing = xmalloc(sizeof *data->backing); data->backing = xmalloc(sizeof *data->backing);
screen_init(data->backing, screen_size_x(&wp->base), screen_init(data->backing, screen_size_x(&wp->base),
screen_size_y(&wp->base), UINT_MAX); screen_size_y(&wp->base), UINT_MAX);
data->backing->mode &= ~MODE_WRAP;
} }
void void
@ -280,7 +279,7 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
struct screen_write_ctx back_ctx, ctx; struct screen_write_ctx back_ctx, ctx;
struct grid_cell gc; struct grid_cell gc;
int utf8flag; int utf8flag;
u_int old_hsize; u_int old_hsize, old_cy;
if (backing == &wp->base) if (backing == &wp->base)
return; return;
@ -299,6 +298,7 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
screen_write_linefeed(&back_ctx, 0); screen_write_linefeed(&back_ctx, 0);
} else } else
data->backing_written = 1; data->backing_written = 1;
old_cy = backing->cy;
screen_write_vnputs(&back_ctx, 0, &gc, utf8flag, fmt, ap); screen_write_vnputs(&back_ctx, 0, &gc, utf8flag, fmt, ap);
screen_write_stop(&back_ctx); screen_write_stop(&back_ctx);
@ -313,9 +313,8 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
if (screen_hsize(data->backing)) if (screen_hsize(data->backing))
window_copy_redraw_lines(wp, 0, 1); window_copy_redraw_lines(wp, 0, 1);
/* Write the line, if it's visible. */ /* Write the new lines. */
if (backing->cy + data->oy < screen_size_y(backing)) window_copy_redraw_lines(wp, old_cy, backing->cy - old_cy + 1);
window_copy_redraw_lines(wp, backing->cy, 1);
screen_write_stop(&ctx); screen_write_stop(&ctx);
} }
@ -345,9 +344,9 @@ window_copy_resize(struct window_pane *wp, u_int sx, u_int sy)
struct screen *s = &data->screen; struct screen *s = &data->screen;
struct screen_write_ctx ctx; struct screen_write_ctx ctx;
screen_resize(s, sx, sy, 0); screen_resize(s, sx, sy, 1);
if (data->backing != &wp->base) if (data->backing != &wp->base)
screen_resize(data->backing, sx, sy, 0); screen_resize(data->backing, sx, sy, 1);
if (data->cy > sy - 1) if (data->cy > sy - 1)
data->cy = sy - 1; data->cy = sy - 1;