Add support for the SD (scroll down) escape sequence, GitHub issue 1861.

This commit is contained in:
nicm
2019-08-05 06:42:02 +00:00
parent c4744620af
commit 45f4ff5485
5 changed files with 76 additions and 4 deletions

44
tty.c
View File

@ -1558,10 +1558,11 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
return;
if (ctx->bigger ||
!tty_pane_full_width(tty, ctx) ||
(!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) ||
tty_fake_bce(tty, wp, 8) ||
!tty_term_has(tty->term, TTYC_CSR) ||
!tty_term_has(tty->term, TTYC_RI) ||
(!tty_term_has(tty->term, TTYC_RI) &&
!tty_term_has(tty->term, TTYC_RIN)) ||
ctx->wp->sx == 1 ||
ctx->wp->sy == 1) {
tty_redraw_region(tty, ctx);
@ -1571,10 +1572,13 @@ tty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx)
tty_default_attributes(tty, wp, ctx->bg);
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
tty_margin_off(tty);
tty_margin_pane(tty, ctx);
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
tty_putcode(tty, TTYC_RI);
if (tty_term_has(tty->term, TTYC_RI))
tty_putcode(tty, TTYC_RI);
else
tty_putcode1(tty, TTYC_RIN, 1);
}
void
@ -1652,6 +1656,38 @@ tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx)
}
}
void
tty_cmd_scrolldown(struct tty *tty, const struct tty_ctx *ctx)
{
struct window_pane *wp = ctx->wp;
u_int i;
if (ctx->bigger ||
(!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) ||
tty_fake_bce(tty, wp, 8) ||
!tty_term_has(tty->term, TTYC_CSR) ||
(!tty_term_has(tty->term, TTYC_RI) &&
!tty_term_has(tty->term, TTYC_RIN)) ||
wp->sx == 1 ||
wp->sy == 1) {
tty_redraw_region(tty, ctx);
return;
}
tty_default_attributes(tty, wp, ctx->bg);
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
tty_margin_pane(tty, ctx);
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper);
if (tty_term_has(tty->term, TTYC_RIN))
tty_putcode1(tty, TTYC_RIN, ctx->num);
else {
for (i = 0; i < ctx->num; i++)
tty_putcode(tty, TTYC_RI);
}
}
void
tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx)
{