diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-07-16 14:11:53 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-07-16 14:11:53 +0000 |
commit | 21f0577141e5b0296a0b26df78e58f9ed98fa8cb (patch) | |
tree | 0e57c4a37e7b43fc7e6fe2097f3fca16b38e18a8 /usr.bin/tmux/tty.c | |
parent | b801b220eae1fdb5542417b3ba39a4447af250de (diff) |
Fix check for wrapping when redrawing entire lines, GitHub issue 1836.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r-- | usr.bin/tmux/tty.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 32c8b352b3d..a0672a35dde 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.328 2019/06/27 15:17:41 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.329 2019/07/16 14:11:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1217,7 +1217,7 @@ tty_draw_line(struct tty *tty, struct window_pane *wp, struct screen *s, const struct grid_cell *gcp; struct grid_line *gl; u_int i, j, ux, sx, width; - int flags, cleared = 0; + int flags, cleared = 0, wrapped = 0; char buf[512]; size_t len; u_int cellsize; @@ -1274,8 +1274,10 @@ tty_draw_line(struct tty *tty, struct window_pane *wp, struct screen *s, tty_putcode(tty, TTYC_EL1); cleared = 1; } - } else + } else { log_debug("%s: wrapped line %u", __func__, aty); + wrapped = 1; + } memcpy(&last, &grid_default_cell, sizeof last); len = 0; @@ -1299,13 +1301,15 @@ tty_draw_line(struct tty *tty, struct window_pane *wp, struct screen *s, tty_clear_line(tty, wp, aty, atx + ux, width, last.bg); } else { - tty_cursor(tty, atx + ux, aty); + if (!wrapped || atx != 0 || ux != 0) + tty_cursor(tty, atx + ux, aty); tty_putn(tty, buf, len, width); } ux += width; len = 0; width = 0; + wrapped = 0; } if (gcp->flags & GRID_FLAG_SELECTED) @@ -1339,7 +1343,8 @@ tty_draw_line(struct tty *tty, struct window_pane *wp, struct screen *s, log_debug("%s: %zu cleared (end)", __func__, len); tty_clear_line(tty, wp, aty, atx + ux, width, last.bg); } else { - tty_cursor(tty, atx + ux, aty); + if (!wrapped || atx != 0 || ux != 0) + tty_cursor(tty, atx + ux, aty); tty_putn(tty, buf, len, width); } ux += width; |