diff options
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 39 |
1 files changed, 26 insertions, 13 deletions
@@ -127,29 +127,40 @@ tty_resize(struct tty *tty) { struct client *c = tty->client; struct winsize ws; - u_int sx, sy; + u_int sx, sy, xpixel, ypixel; if (ioctl(tty->fd, TIOCGWINSZ, &ws) != -1) { sx = ws.ws_col; - if (sx == 0) + if (sx == 0) { sx = 80; + xpixel = 0; + } else + xpixel = ws.ws_xpixel / sx; sy = ws.ws_row; - if (sy == 0) + if (sy == 0) { sy = 24; + ypixel = 0; + } else + ypixel = ws.ws_ypixel / sy; } else { sx = 80; sy = 24; + xpixel = 0; + ypixel = 0; } - log_debug("%s: %s now %ux%u", __func__, c->name, sx, sy); - tty_set_size(tty, sx, sy); + log_debug("%s: %s now %ux%u (%ux%u)", __func__, c->name, sx, sy, + xpixel, ypixel); + tty_set_size(tty, sx, sy, xpixel, ypixel); tty_invalidate(tty); } void -tty_set_size(struct tty *tty, u_int sx, u_int sy) +tty_set_size(struct tty *tty, u_int sx, u_int sy, u_int xpixel, u_int ypixel) { tty->sx = sx; tty->sy = sy; + tty->xpixel = xpixel; + tty->ypixel = ypixel; } static void @@ -2106,7 +2117,9 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy) if ((u_int) abs(change) > cx && tty_term_has(term, TTYC_HPA)) { tty_putcode1(tty, TTYC_HPA, cx); goto out; - } else if (change > 0 && tty_term_has(term, TTYC_CUB)) { + } else if (change > 0 && + tty_term_has(term, TTYC_CUB) && + !tty_use_margin(tty)) { if (change == 2 && tty_term_has(term, TTYC_CUB1)) { tty_putcode(tty, TTYC_CUB1); tty_putcode(tty, TTYC_CUB1); @@ -2114,7 +2127,9 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy) } tty_putcode1(tty, TTYC_CUB, change); goto out; - } else if (change < 0 && tty_term_has(term, TTYC_CUF)) { + } else if (change < 0 && + tty_term_has(term, TTYC_CUF) && + !tty_use_margin(tty)) { tty_putcode1(tty, TTYC_CUF, -change); goto out; } @@ -2374,10 +2389,7 @@ tty_check_fg(struct tty *tty, struct window_pane *wp, struct grid_cell *gc) gc->fg &= 7; if (colours >= 16) gc->fg += 90; - else - gc->attr |= GRID_ATTR_BRIGHT; - } else - gc->attr &= ~GRID_ATTR_BRIGHT; + } } return; } @@ -2442,7 +2454,8 @@ tty_check_bg(struct tty *tty, struct window_pane *wp, struct grid_cell *gc) } static void -tty_check_us(__unused struct tty *tty, struct window_pane *wp, struct grid_cell *gc) +tty_check_us(__unused struct tty *tty, struct window_pane *wp, + struct grid_cell *gc) { int c; |