void tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; u_int i; if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff); return; } tty_reset(tty); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); if (tty_term_has(tty->term, TTYC_ICH) || tty_term_has(tty->term, TTYC_ICH1)) tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num); else if (tty_term_has(tty->term, TTYC_SMIR) && tty_term_has(tty->term, TTYC_RMIR)) { tty_putcode(tty, TTYC_SMIR); for (i = 0; i < ctx->num; i++) tty_putc(tty, ' '); tty_putcode(tty, TTYC_RMIR); } else tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff); }
/* * Redraw scroll region using data from screen (already updated). Used when * CSR not supported, or window is a pane that doesn't take up the full * width of the terminal. */ void tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; u_int i; /* * If region is >= 50% of the screen, just schedule a window redraw. In * most cases, this is likely to be followed by some more scrolling - * without this, the entire pane ends up being redrawn many times which * can be much more data. */ if (ctx->orlower - ctx->orupper >= screen_size_y(s) / 2) { wp->flags |= PANE_REDRAW; return; } if (ctx->ocy < ctx->orupper || ctx->ocy > ctx->orlower) { for (i = ctx->ocy; i < screen_size_y(s); i++) tty_draw_line(tty, s, i, wp->xoff, wp->yoff); } else { for (i = ctx->orupper; i <= ctx->orlower; i++) tty_draw_line(tty, s, i, wp->xoff, wp->yoff); } }
void tty_cmd_insertcharacter(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_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); return; } ua = va_arg(ap, u_int); tty_reset(tty); tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); if (tty_term_has(tty->term, TTYC_ICH) || tty_term_has(tty->term, TTYC_ICH1)) tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ua); else { tty_putcode(tty, TTYC_SMIR); while (ua-- > 0) tty_putc(tty, ' '); tty_putcode(tty, TTYC_RMIR); } }
void tty_cmd_utf8character(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; /* * Cannot rely on not being a partial character, so just redraw the * whole line. */ tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff); }
void tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; if (!tty_pane_full_width(tty, ctx)) { tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff); return; } tty_reset(tty); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); if (tty_term_has(tty->term, TTYC_ICH) || tty_term_has(tty->term, TTYC_ICH1)) tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num); else tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff); }
/* * Redraw scroll region using data from screen (already updated). Used when * CSR not supported, or window is a pane that doesn't take up the full * width of the terminal. */ void tty_redraw_region(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; u_int i; /* * If region is large, schedule a window redraw. In most cases this is * likely to be followed by some more scrolling. */ if (tty_large_region(tty, ctx)) { wp->flags |= PANE_REDRAW; return; } if (ctx->ocy < ctx->orupper || ctx->ocy > ctx->orlower) { for (i = ctx->ocy; i < screen_size_y(s); i++) tty_draw_line(tty, s, i, ctx->xoff, ctx->yoff); } else { for (i = ctx->orupper; i <= ctx->orlower; i++) tty_draw_line(tty, s, i, ctx->xoff, ctx->yoff); } }
void tty_cmd_deletecharacter(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_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); return; } ua = va_arg(ap, u_int); tty_reset(tty); tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ua); }
void tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; if (wp->xoff != 0 || screen_size_x(s) < tty->sx || (!tty_term_has(tty->term, TTYC_DCH) && !tty_term_has(tty->term, TTYC_DCH1))) { tty_draw_line(tty, wp->screen, ctx->ocy, wp->xoff, wp->yoff); return; } tty_reset(tty); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); if (tty_term_has(tty->term, TTYC_DCH) || tty_term_has(tty->term, TTYC_DCH1)) tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ctx->num); }