diff options
author | 2017-02-08 17:31:09 +0000 | |
---|---|---|
committer | 2017-02-08 17:31:09 +0000 | |
commit | f0063641693bf9c391e3380df0dc2de8d6de156d (patch) | |
tree | 5e006532064dcfaad83a6e6d9f5c9f0b563369f3 /usr.bin/tmux/tty.c | |
parent | Cleanup the device removal path (diff) | |
download | wireguard-openbsd-f0063641693bf9c391e3380df0dc2de8d6de156d.tar.xz wireguard-openbsd-f0063641693bf9c391e3380df0dc2de8d6de156d.zip |
Add support for scroll up escape sequence (CSI S) and use it when
possible instead of sending individual line feeds.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r-- | usr.bin/tmux/tty.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index d06e5dc4a7f..49e68a880a2 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.239 2017/02/08 16:45:18 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.240 2017/02/08 17:31:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1022,6 +1022,32 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) } void +tty_cmd_scrollup(struct tty *tty, const struct tty_ctx *ctx) +{ + struct window_pane *wp = ctx->wp; + u_int i; + + if ((!tty_pane_full_width(tty, ctx) && !tty_use_margin(tty)) || + tty_fake_bce(tty, wp, ctx->bg) || + !tty_term_has(tty->term, TTYC_CSR)) { + tty_redraw_region(tty, ctx); + return; + } + + tty_attributes(tty, &grid_default_cell, wp); + + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); + tty_margin_pane(tty, ctx); + + if (ctx->num == 1 || !tty_term_has(tty->term, TTYC_INDN)) { + tty_cursor(tty, tty->rright, ctx->yoff + tty->rlower); + for (i = 0; i < ctx->num; i++) + tty_putc(tty, '\n'); + } else + tty_putcode1(tty, TTYC_INDN, ctx->num); +} + +void tty_cmd_clearendofscreen(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; |