=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-buffer.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- src/usr.bin/tmux/window-buffer.c 2017/10/25 11:26:11 1.10 +++ src/usr.bin/tmux/window-buffer.c 2017/11/02 22:00:42 1.11 @@ -1,4 +1,4 @@ -/* $OpenBSD: window-buffer.c,v 1.10 2017/10/25 11:26:11 nicm Exp $ */ +/* $OpenBSD: window-buffer.c,v 1.11 2017/11/02 22:00:42 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott @@ -196,27 +196,21 @@ } -static struct screen * -window_buffer_draw(__unused void *modedata, void *itemdata, u_int sx, u_int sy) +static void +window_buffer_draw(__unused void *modedata, void *itemdata, + struct screen_write_ctx *ctx, u_int sx, u_int sy) { struct window_buffer_itemdata *item = itemdata; struct paste_buffer *pb; - static struct screen s; - struct screen_write_ctx ctx; char line[1024]; const char *pdata, *end, *cp; size_t psize, at; - u_int i; + u_int i, cx = ctx->s->cx, cy = ctx->s->cy; pb = paste_get_name(item->name); if (pb == NULL) - return (NULL); + return; - screen_init(&s, sx, sy, 0); - - screen_write_start(&ctx, NULL, &s); - screen_write_clearscreen(&ctx, 8); - pdata = end = paste_buffer_data(pb, &psize); for (i = 0; i < sy; i++) { at = 0; @@ -232,17 +226,14 @@ line[at] = '\0'; if (*line != '\0') { - screen_write_cursormove(&ctx, 0, i); - screen_write_puts(&ctx, &grid_default_cell, "%s", line); + screen_write_cursormove(ctx, cx, cy + i); + screen_write_puts(ctx, &grid_default_cell, "%s", line); } if (end == pdata + psize) break; end++; } - - screen_write_stop(&ctx); - return (&s); } static int