summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/screen-write.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-11-15 19:21:24 +0000
committernicm <nicm@openbsd.org>2017-11-15 19:21:24 +0000
commit414c61adb98caf0e1330a0138968ad5bb58c8e0c (patch)
tree33b8ca17495bb3e94466f06f02f7203b9088531b /usr.bin/tmux/screen-write.c
parentIf there is a double width character at the very end of the line with (diff)
downloadwireguard-openbsd-414c61adb98caf0e1330a0138968ad5bb58c8e0c.tar.xz
wireguard-openbsd-414c61adb98caf0e1330a0138968ad5bb58c8e0c.zip
Completely rewrite the reflow code to correctly handle double width
characters (previously they were not accounted for).
Diffstat (limited to 'usr.bin/tmux/screen-write.c')
-rw-r--r--usr.bin/tmux/screen-write.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index 028ddcf5dac..6b738ca5724 100644
--- a/usr.bin/tmux/screen-write.c
+++ b/usr.bin/tmux/screen-write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.134 2017/11/03 17:02:33 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.135 2017/11/15 19:21:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -378,7 +378,8 @@ screen_write_copy(struct screen_write_ctx *ctx, struct screen *src, u_int px,
gc.bg = mgc->bg;
}
}
- screen_write_cell(ctx, &gc);
+ if (xx + gc.data.width <= px + nx)
+ screen_write_cell(ctx, &gc);
}
cy++;
screen_write_cursormove(ctx, cx, cy);
@@ -410,6 +411,8 @@ screen_write_fast_copy(struct screen_write_ctx *ctx, struct screen *src,
if (xx >= gd->linedata[yy].cellsize)
break;
grid_get_cell(gd, xx, yy, &gc);
+ if (xx + gc.data.width > px + nx)
+ break;
if (!grid_cells_equal(&gc, &grid_default_cell))
grid_view_set_cell(ctx->s->grid, cx, cy, &gc);
cx++;