diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-08-05 06:42:03 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-08-05 06:42:03 +0000 |
commit | c7117cbdfece215a5f8fa5ff0c83e7aea97e6718 (patch) | |
tree | f9ad0d249772ba97b6dbb6073e6675e9d14709e4 /usr.bin/tmux/tty.c | |
parent | 161d5e945d1a826b1198b6780c9784f3573cbc2d (diff) |
Add support for the SD (scroll down) escape sequence, GitHub issue 1861.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r-- | usr.bin/tmux/tty.c | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index c4b5ae4886f..3e9f90fd029 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.330 2019/08/01 11:45:34 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.331 2019/08/05 06:42:02 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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; |