diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-02-07 17:13:29 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-02-07 17:13:29 +0000 |
commit | b5f0b38252e2338e048adce12dde40f7a6cae620 (patch) | |
tree | fa8e6b27113f2c4f8f786ce8d2825fc06ae20518 | |
parent | 23ba40f5c468217e574fdc8c4e58630326c30d9d (diff) |
DECSLRM in xterm(1) appears to have a quirk where it can generate an
extra scroll of the entire terminal; issuing DECSTBM first prevents
this. Do that for now.
-rw-r--r-- | usr.bin/tmux/tty.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index c982cce1355..e10fe83d575 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.230 2017/02/07 14:33:37 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.231 2017/02/07 17:13:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -445,6 +445,7 @@ tty_puts(struct tty *tty, const char *s) if (tty_log_fd != -1) write(tty_log_fd, s, strlen(s)); + log_debug("%s: %s", tty->path, s); } void @@ -454,12 +455,17 @@ tty_putc(struct tty *tty, u_char ch) if (tty->cell.attr & GRID_ATTR_CHARSET) { acs = tty_acs_get(tty, ch); - if (acs != NULL) + if (acs != NULL) { bufferevent_write(tty->event, acs, strlen(acs)); - else + log_debug("%s: %s", tty->path, acs); + } else { bufferevent_write(tty->event, &ch, 1); - } else + log_debug("%s: %c", tty->path, ch); + } + } else { bufferevent_write(tty->event, &ch, 1); + log_debug("%s: %c", tty->path, ch); + } if (ch >= 0x20 && ch != 0x7f) { if (tty->cx >= tty->sx) { @@ -486,8 +492,11 @@ void tty_putn(struct tty *tty, const void *buf, size_t len, u_int width) { bufferevent_write(tty->event, buf, len); + if (tty_log_fd != -1) write(tty_log_fd, buf, len); + log_debug("%s: %.*s", tty->path, (int)len, (char *)buf); + tty->cx += width; } @@ -1319,7 +1328,7 @@ tty_region(struct tty *tty, u_int rupper, u_int rlower) tty_cursor(tty, 0, tty->cy); tty_putcode2(tty, TTYC_CSR, tty->rupper, tty->rlower); - tty_cursor(tty, 0, 0); + tty->cx = tty->cy = 0; } /* Turn off margin. */ @@ -1347,12 +1356,15 @@ tty_margin(struct tty *tty, u_int rleft, u_int rright) if (tty->rleft == rleft && tty->rright == rright) return; + tty->rupper = 0; + tty->rlower = tty->sy - 1; + tty->rleft = rleft; tty->rright = rright; - snprintf(s, sizeof s, "\033[%u;%us", rleft + 1, rright + 1); + snprintf(s, sizeof s, "\033[r\033[%u;%us", rleft + 1, rright + 1); tty_puts(tty, s); - tty_cursor(tty, 0, 0); + tty->cx = tty->cy = 0; } /* Move cursor inside pane. */ |