aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2019-08-05 06:42:02 +0000
committernicm <nicm>2019-08-05 06:42:02 +0000
commit45f4ff54850ff9b448070a96b33e63451f973e33 (patch)
treee8a40ff8eb12263b801fb774582f6d3c8ac3f6e9 /tty.c
parentc4744620af18de13d4a2981b78992ae9ddfd937a (diff)
downloadrtmux-45f4ff54850ff9b448070a96b33e63451f973e33.tar.gz
rtmux-45f4ff54850ff9b448070a96b33e63451f973e33.tar.bz2
rtmux-45f4ff54850ff9b448070a96b33e63451f973e33.zip
Add support for the SD (scroll down) escape sequence, GitHub issue 1861.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/tty.c b/tty.c
index 024aef27..1658fb74 100644
--- a/tty.c
+++ b/tty.c
@@ -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
@@ -1653,6 +1657,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)
{
struct window_pane *wp = ctx->wp;