void tty_cmd_insertline(struct tty *tty, struct window_pane *wp, va_list ap) { struct screen *s = wp->screen; u_int ua; if (wp->xoff != 0 || screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) { tty_redraw_region(tty, wp); return; } ua = va_arg(ap, u_int); tty_reset(tty); tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff); tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ua); }
int tty_resize(struct tty *tty) { struct winsize ws; u_int sx, sy; if (ioctl(tty->fd, TIOCGWINSZ, &ws) != -1) { sx = ws.ws_col; if (sx == 0) sx = 80; sy = ws.ws_row; if (sy == 0) sy = 24; } else { sx = 80; sy = 24; } if (sx == tty->sx && sy == tty->sy) return (0); tty->sx = sx; tty->sy = sy; tty->cx = UINT_MAX; tty->cy = UINT_MAX; tty->rupper = UINT_MAX; tty->rlower = UINT_MAX; /* * If the terminal has been started, reset the actual scroll region and * cursor position, as this may not have happened. */ if (tty->flags & TTY_STARTED) { tty_cursor(tty, 0, 0); tty_region(tty, 0, tty->sy - 1); } return (1); }
/* Set region inside pane. */ void tty_region_pane( struct tty *tty, const struct tty_ctx *ctx, u_int rupper, u_int rlower) { tty_region(tty, ctx->yoff + rupper, ctx->yoff + rlower); }