aboutsummaryrefslogtreecommitdiff
path: root/screen-write.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-08-06 07:02:33 +0100
committerThomas Adam <thomas@xteddy.org>2019-08-06 07:02:33 +0100
commit9b3fefc43529666b1f6adc5efc89f6a5f127f274 (patch)
tree4ecbf1bbb63a701276b26d3762384ee717f76565 /screen-write.c
parenteb8eeab05e5ef158674f7d4ace78ba4caa0bb27e (diff)
parent45f4ff54850ff9b448070a96b33e63451f973e33 (diff)
downloadrtmux-9b3fefc43529666b1f6adc5efc89f6a5f127f274.tar.gz
rtmux-9b3fefc43529666b1f6adc5efc89f6a5f127f274.tar.bz2
rtmux-9b3fefc43529666b1f6adc5efc89f6a5f127f274.zip
Merge branch 'obsd-master'
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/screen-write.c b/screen-write.c
index 98cdf158..66053eaf 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -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)