aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2017-02-07 17:13:28 +0000
committernicm <nicm>2017-02-07 17:13:28 +0000
commit6ea36afc4b52f0b5e29260ee9bbfb7e76db4078f (patch)
tree0abb56d450057c95e79610465e6834db774037d1 /tty.c
parent9491a5c1cfad69e49d3dcbf7df77768ab6cf7a87 (diff)
downloadrtmux-6ea36afc4b52f0b5e29260ee9bbfb7e76db4078f.tar.gz
rtmux-6ea36afc4b52f0b5e29260ee9bbfb7e76db4078f.tar.bz2
rtmux-6ea36afc4b52f0b5e29260ee9bbfb7e76db4078f.zip
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.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/tty.c b/tty.c
index 545ffb07..01e5fde2 100644
--- a/tty.c
+++ b/tty.c
@@ -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. */