=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/screen-write.c,v retrieving revision 1.121 retrieving revision 1.122 diff -u -r1.121 -r1.122 --- src/usr.bin/tmux/screen-write.c 2017/05/12 10:50:11 1.121 +++ src/usr.bin/tmux/screen-write.c 2017/05/12 13:00:56 1.122 @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.121 2017/05/12 10:50:11 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.122 2017/05/12 13:00:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -75,6 +75,9 @@ TAILQ_INIT(&ctx->list[y].items); ctx->item = xcalloc(1, sizeof *ctx->item); + ctx->scrolled = 0; + ctx->bg = 8; + if (wp != NULL) snprintf(tmp, sizeof tmp, "pane %%%u", wp->id); log_debug("%s: size %ux%u, %s", __func__, screen_size_x(ctx->s), @@ -810,15 +813,16 @@ /* Reverse index (up with scroll). */ void -screen_write_reverseindex(struct screen_write_ctx *ctx) +screen_write_reverseindex(struct screen_write_ctx *ctx, u_int bg) { struct screen *s = ctx->s; struct tty_ctx ttyctx; screen_write_initctx(ctx, &ttyctx); + ttyctx.bg = bg; if (s->cy == s->rupper) - grid_view_scroll_region_down(s->grid, s->rupper, s->rlower); + grid_view_scroll_region_down(s->grid, s->rupper, s->rlower, bg); else if (s->cy > 0) s->cy--; @@ -852,7 +856,7 @@ /* Line feed. */ void -screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped) +screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped, u_int bg) { struct screen *s = ctx->s; struct grid *gd = s->grid; @@ -867,8 +871,13 @@ log_debug("%s: at %u,%u (region %u-%u)", __func__, s->cx, s->cy, s->rupper, s->rlower); + if (bg != ctx->bg) { + screen_write_collect_flush(ctx, 1); + ctx->bg = bg; + } + if (s->cy == s->rlower) { - grid_view_scroll_region_up(gd, s->rupper, s->rlower); + grid_view_scroll_region_up(gd, s->rupper, s->rlower, bg); screen_write_collect_scroll(ctx); ctx->scrolled++; } else if (s->cy < screen_size_y(s) - 1) @@ -877,7 +886,7 @@ /* Scroll up. */ void -screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines) +screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines, u_int bg) { struct screen *s = ctx->s; struct grid *gd = s->grid; @@ -888,8 +897,13 @@ else if (lines > s->rlower - s->rupper + 1) lines = s->rlower - s->rupper + 1; + if (bg != ctx->bg) { + screen_write_collect_flush(ctx, 1); + ctx->bg = bg; + } + for (i = 0; i < lines; i++) { - grid_view_scroll_region_up(gd, s->rupper, s->rlower); + grid_view_scroll_region_up(gd, s->rupper, s->rlower, bg); screen_write_collect_scroll(ctx); } ctx->scrolled += lines; @@ -1044,9 +1058,12 @@ screen_write_initctx(ctx, &ttyctx); ttyctx.num = ctx->scrolled; + ttyctx.bg = ctx->bg; tty_write(tty_cmd_scrollup, &ttyctx); } ctx->scrolled = 0; + ctx->bg = 8; + if (scroll_only) return; @@ -1141,7 +1158,7 @@ if (s->cx > sx - 1) { log_debug("%s: wrapped at %u,%u", __func__, s->cx, s->cy); ci->wrapped = 1; - screen_write_linefeed(ctx, 1); + screen_write_linefeed(ctx, 1, 8); s->cx = 0; } @@ -1202,7 +1219,7 @@ /* Check this will fit on the current line and wrap if not. */ if ((s->mode & MODE_WRAP) && s->cx > sx - width) { - screen_write_linefeed(ctx, 1); + screen_write_linefeed(ctx, 1, 8); s->cx = 0; }