summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-11-06 10:56:45 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-11-06 10:56:45 +0000
commitbab97310998c3d1b719a5325fdbb2453ef7ae29a (patch)
tree7205afa24a9ffd2b61ca6e1bacfe288f690441c2 /usr.bin/tmux/window-copy.c
parent0f9a2f18ad6d8206346a757f4df6b2a0cfadfa93 (diff)
Wrap when copy mode is used for output, from Balazs Kezes.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index d325fc4564e..4f6ac17adb7 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.118 2014/11/06 09:17:26 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.119 2014/11/06 10:56:44 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -239,7 +239,6 @@ window_copy_init_for_output(struct window_pane *wp)
data->backing = xmalloc(sizeof *data->backing);
screen_init(data->backing, screen_size_x(&wp->base),
screen_size_y(&wp->base), UINT_MAX);
- data->backing->mode &= ~MODE_WRAP;
}
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 grid_cell gc;
int utf8flag;
- u_int old_hsize;
+ u_int old_hsize, old_cy;
if (backing == &wp->base)
return;
@@ -299,6 +298,7 @@ window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
screen_write_linefeed(&back_ctx, 0);
} else
data->backing_written = 1;
+ old_cy = backing->cy;
screen_write_vnputs(&back_ctx, 0, &gc, utf8flag, fmt, ap);
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))
window_copy_redraw_lines(wp, 0, 1);
- /* Write the line, if it's visible. */
- if (backing->cy + data->oy < screen_size_y(backing))
- window_copy_redraw_lines(wp, backing->cy, 1);
+ /* Write the new lines. */
+ window_copy_redraw_lines(wp, old_cy, backing->cy - old_cy + 1);
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_write_ctx ctx;
- screen_resize(s, sx, sy, 0);
+ screen_resize(s, sx, sy, 1);
if (data->backing != &wp->base)
- screen_resize(data->backing, sx, sy, 0);
+ screen_resize(data->backing, sx, sy, 1);
if (data->cy > sy - 1)
data->cy = sy - 1;