summaryrefslogtreecommitdiffstats
path: root/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm>2017-04-25 18:30:29 +0000
committernicm <nicm>2017-04-25 18:30:29 +0000
commitd520dae6ac9acf980d48fbc8307ac83a5cee2938 (patch)
tree07f119b181cb4ac410685f7a728c37d7920aa2b7 /screen-write.c
parent03d01eabb5c5227f56b6b44d04964c1328802628 (diff)
Make full width panes try to play more nicely with terminal copy and
paste by avoiding explicit line wraps if we think the terminal will wrap anyway.
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/screen-write.c b/screen-write.c
index 41f1c23c..a034261e 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -41,6 +41,7 @@ static const struct grid_cell screen_write_pad_cell = {
struct screen_write_collect_item {
u_int x;
+ int wrapped;
u_int used;
char data[256];
@@ -1054,6 +1055,7 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only)
screen_write_cursormove(ctx, ci->x, y);
screen_write_initctx(ctx, &ttyctx);
ttyctx.cell = &ci->gc;
+ ttyctx.wrapped = ci->wrapped;
ttyctx.ptr = ci->data;
ttyctx.num = ci->used;
tty_write(tty_cmd_cells, &ttyctx);
@@ -1133,13 +1135,15 @@ screen_write_collect_add(struct screen_write_ctx *ctx,
if (s->cx > sx - 1 || ctx->item->used > sx - 1 - s->cx)
screen_write_collect_end(ctx);
+ ci = ctx->item; /* may have changed */
+
if (s->cx > sx - 1) {
log_debug("%s: wrapped at %u,%u", __func__, s->cx, s->cy);
+ ci->wrapped = 1;
screen_write_linefeed(ctx, 1);
s->cx = 0;
}
- ci = ctx->item; /* may have changed */
if (ci->used == 0)
memcpy(&ci->gc, gc, sizeof ci->gc);
ci->data[ci->used++] = gc->data.data[0];