aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-02-07 18:01:13 +0000
committerThomas Adam <thomas@xteddy.org>2017-02-07 18:01:13 +0000
commit178289fb4c9d30a9d8cde60ef9d055c6a7e9882b (patch)
treea5b08eaadb3adb19ae86330bb3972033743ac304 /tty.c
parent97fd2910795f8b63b2e32eb27fed8e6a8dac5086 (diff)
parent6ea36afc4b52f0b5e29260ee9bbfb7e76db4078f (diff)
downloadrtmux-178289fb4c9d30a9d8cde60ef9d055c6a7e9882b.tar.gz
rtmux-178289fb4c9d30a9d8cde60ef9d055c6a7e9882b.tar.bz2
rtmux-178289fb4c9d30a9d8cde60ef9d055c6a7e9882b.zip
Merge branch 'obsd-master'
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. */