summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/input.c9
-rw-r--r--usr.bin/tmux/screen-write.c27
-rw-r--r--usr.bin/tmux/tmux.h5
-rw-r--r--usr.bin/tmux/tty-term.c3
-rw-r--r--usr.bin/tmux/tty.c46
5 files changed, 81 insertions, 9 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 7881dbdb3a2..b1b306f8cc1 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.158 2019/06/27 15:17:41 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.159 2019/08/05 06:42:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -244,6 +244,7 @@ enum input_csi_type {
INPUT_CSI_RM,
INPUT_CSI_RM_PRIVATE,
INPUT_CSI_SCP,
+ INPUT_CSI_SD,
INPUT_CSI_SGR,
INPUT_CSI_SM,
INPUT_CSI_SM_PRIVATE,
@@ -270,6 +271,7 @@ static const struct input_table_entry input_csi_table[] = {
{ 'M', "", INPUT_CSI_DL },
{ 'P', "", INPUT_CSI_DCH },
{ 'S', "", INPUT_CSI_SU },
+ { 'T', "", INPUT_CSI_SD },
{ 'X', "", INPUT_CSI_ECH },
{ 'Z', "", INPUT_CSI_CBT },
{ '`', "", INPUT_CSI_HPA },
@@ -1525,6 +1527,11 @@ input_csi_dispatch(struct input_ctx *ictx)
if (n != -1)
screen_write_scrollup(sctx, n, bg);
break;
+ case INPUT_CSI_SD:
+ n = input_get(ictx, 0, 1, 1);
+ if (n != -1)
+ screen_write_scrolldown(sctx, n, bg);
+ break;
case INPUT_CSI_TBC:
switch (input_get(ictx, 0, 0, 0)) {
case -1:
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index 0a8d6665755..7e169c21c2d 100644
--- a/usr.bin/tmux/screen-write.c
+++ b/usr.bin/tmux/screen-write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.156 2019/07/08 11:38:14 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.157 2019/08/05 06:42:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1088,6 +1088,31 @@ screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines, u_int bg)
ctx->scrolled += lines;
}
+/* Scroll down. */
+void
+screen_write_scrolldown(struct screen_write_ctx *ctx, u_int lines, u_int bg)
+{
+ struct screen *s = ctx->s;
+ struct grid *gd = s->grid;
+ struct tty_ctx ttyctx;
+ u_int i;
+
+ screen_write_initctx(ctx, &ttyctx);
+ ttyctx.bg = bg;
+
+ if (lines == 0)
+ lines = 1;
+ else if (lines > s->rlower - s->rupper + 1)
+ lines = s->rlower - s->rupper + 1;
+
+ for (i = 0; i < lines; i++)
+ grid_view_scroll_region_down(gd, s->rupper, s->rlower, bg);
+
+ screen_write_collect_flush(ctx, 0);
+ ttyctx.num = lines;
+ tty_write(tty_cmd_scrolldown, &ttyctx);
+}
+
/* Carriage return (cursor to start of line). */
void
screen_write_carriagereturn(struct screen_write_ctx *ctx)
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index ad54c910c2e..fc5884e5298 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.922 2019/07/15 18:25:07 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.923 2019/08/05 06:42:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -420,6 +420,7 @@ enum tty_code_code {
TTYC_REV,
TTYC_RGB,
TTYC_RI,
+ TTYC_RIN,
TTYC_RMACS,
TTYC_RMCUP,
TTYC_RMKX,
@@ -1925,6 +1926,7 @@ void tty_cmd_insertcharacter(struct tty *, const struct tty_ctx *);
void tty_cmd_insertline(struct tty *, const struct tty_ctx *);
void tty_cmd_linefeed(struct tty *, const struct tty_ctx *);
void tty_cmd_scrollup(struct tty *, const struct tty_ctx *);
+void tty_cmd_scrolldown(struct tty *, const struct tty_ctx *);
void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
void tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
@@ -2301,6 +2303,7 @@ void screen_write_reverseindex(struct screen_write_ctx *, u_int);
void screen_write_scrollregion(struct screen_write_ctx *, u_int, u_int);
void screen_write_linefeed(struct screen_write_ctx *, int, u_int);
void screen_write_scrollup(struct screen_write_ctx *, u_int, u_int);
+void screen_write_scrolldown(struct screen_write_ctx *, u_int, u_int);
void screen_write_carriagereturn(struct screen_write_ctx *);
void screen_write_clearendofscreen(struct screen_write_ctx *, u_int);
void screen_write_clearstartofscreen(struct screen_write_ctx *, u_int);
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c
index 3db4f5e15f4..b71d846717d 100644
--- a/usr.bin/tmux/tty-term.c
+++ b/usr.bin/tmux/tty-term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-term.c,v 1.66 2019/06/27 15:17:41 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.67 2019/08/05 06:42:02 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -239,6 +239,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_REV] = { TTYCODE_STRING, "rev" },
[TTYC_RGB] = { TTYCODE_FLAG, "RGB" },
[TTYC_RI] = { TTYCODE_STRING, "ri" },
+ [TTYC_RIN] = { TTYCODE_STRING, "rin" },
[TTYC_RMACS] = { TTYCODE_STRING, "rmacs" },
[TTYC_RMCUP] = { TTYCODE_STRING, "rmcup" },
[TTYC_RMKX] = { TTYCODE_STRING, "rmkx" },
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;