Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 606568
Collapse All | Expand All

(-)a/screen-write.c (-29 / +9 lines)
Lines 389-431 screen_write_cnputs(struct screen_write_ctx *ctx, ssize_t maxlen, Link Here
389
389
390
/* Copy from another screen. */
390
/* Copy from another screen. */
391
void
391
void
392
screen_write_copy(struct screen_write_ctx *ctx,
392
screen_write_copy(struct screen_write_ctx *ctx, struct screen *src, u_int px,
393
    struct screen *src, u_int px, u_int py, u_int nx, u_int ny)
393
    u_int py, u_int nx, u_int ny)
394
{
394
{
395
	struct screen		*s = ctx->s;
395
	struct screen		*s = ctx->s;
396
	struct grid		*gd = src->grid;
396
	struct grid		*gd = src->grid;
397
	struct grid_line	*gl;
398
	struct grid_cell	 gc;
397
	struct grid_cell	 gc;
399
	u_int		 	 xx, yy, cx, cy, ax, bx;
398
	u_int		 	 xx, yy, cx, cy;
400
399
401
	cx = s->cx;
400
	cx = s->cx;
402
	cy = s->cy;
401
	cy = s->cy;
402
403
	for (yy = py; yy < py + ny; yy++) {
403
	for (yy = py; yy < py + ny; yy++) {
404
		gl = &gd->linedata[yy];
404
		for (xx = px; xx < px + nx; xx++) {
405
		if (yy < gd->hsize + gd->sy) {
405
			grid_get_cell(gd, xx, yy, &gc);
406
			/*
406
			screen_write_cell(ctx, &gc);
407
			 * Find start and end position and copy between
407
		}
408
			 * them. Limit to the real end of the line then use a
408
409
			 * clear EOL only if copying to the end, otherwise
410
			 * could overwrite whatever is there already.
411
			 */
412
			if (px > gl->cellsize)
413
				ax = gl->cellsize;
414
			else
415
				ax = px;
416
			if (px + nx == gd->sx && px + nx > gl->cellsize)
417
				bx = gl->cellsize;
418
			else
419
				bx = px + nx;
420
421
			for (xx = ax; xx < bx; xx++) {
422
				grid_get_cell(gd, xx, yy, &gc);
423
				screen_write_cell(ctx, &gc);
424
			}
425
			if (px + nx == gd->sx && px + nx > gl->cellsize)
426
				screen_write_clearendofline(ctx);
427
		} else
428
			screen_write_clearline(ctx);
429
		cy++;
409
		cy++;
430
		screen_write_cursormove(ctx, cx, cy);
410
		screen_write_cursormove(ctx, cx, cy);
431
	}
411
	}

Return to bug 606568