summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-07-21 22:55:45 +0000
committernicm <nicm@openbsd.org>2017-07-21 22:55:45 +0000
commit8aabbf681f7880916548cd985200441acdb8c6f4 (patch)
tree1ecccc31b080b3b729a159cb060120194ff67cda
parentStress the fact that individual pvbus device nodes correspond to (diff)
downloadwireguard-openbsd-8aabbf681f7880916548cd985200441acdb8c6f4.tar.xz
wireguard-openbsd-8aabbf681f7880916548cd985200441acdb8c6f4.zip
Use the actual width written rather than the possible width to clear.
-rw-r--r--usr.bin/tmux/tty.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index db69f056033..829316708ab 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.291 2017/07/21 14:25:29 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.292 2017/07/21 22:55:45 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -882,7 +882,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
struct screen *s, u_int py, u_int ox, u_int oy)
{
struct grid_cell gc, last;
- u_int i, j, sx, nx, width;
+ u_int i, j, ux, sx, nx, width;
int flags, cleared = 0;
char buf[512];
size_t len, old_len;
@@ -903,6 +903,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
sx = s->grid->linedata[s->grid->hsize + py].cellsize;
if (sx > tty->sx)
sx = tty->sx;
+ ux = 0;
if (wp == NULL ||
py == 0 ||
@@ -944,6 +945,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
(sizeof buf) - len < gc.data.size)) {
tty_attributes(tty, &last, wp);
tty_putn(tty, buf, len, width);
+ ux += width;
len = 0;
width = 0;
@@ -966,6 +968,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
for (j = 0; j < gc.data.size; j++)
tty_putc(tty, gc.data.data[j]);
}
+ ux += gc.data.width;
} else {
memcpy(buf + len, gc.data.data, gc.data.size);
len += gc.data.size;
@@ -975,21 +978,24 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
if (len != 0) {
if (grid_cells_equal(&last, &grid_default_cell)) {
old_len = len;
- while (len > 0 && buf[len - 1] == ' ')
+ while (len > 0 && buf[len - 1] == ' ') {
len--;
+ width--;
+ }
log_debug("%s: trimmed %zu spaces", __func__,
old_len - len);
}
if (len != 0) {
tty_attributes(tty, &last, wp);
tty_putn(tty, buf, len, width);
+ ux += width;
}
}
- nx = screen_size_x(s) - sx;
- if (!cleared && sx < tty->sx && nx != 0) {
+ nx = screen_size_x(s) - ux;
+ if (!cleared && ux < tty->sx && nx != 0) {
tty_default_attributes(tty, wp, 8);
- tty_clear_line(tty, wp, oy + py, ox + sx, nx, 8);
+ tty_clear_line(tty, wp, oy + py, ox + ux, nx, 8);
}
tty->flags = (tty->flags & ~TTY_NOCURSOR) | flags;