version 1.131, 2017/10/05 08:12:24 |
version 1.132, 2017/11/02 21:29:17 |
|
|
free(msg); |
free(msg); |
} |
} |
|
|
/* Copy from another screen. */ |
/* Copy from another screen. Assumes target region is big enough. */ |
void |
void |
screen_write_copy(struct screen_write_ctx *ctx, struct screen *src, u_int px, |
screen_write_copy(struct screen_write_ctx *ctx, struct screen *src, u_int px, |
u_int py, u_int nx, u_int ny, bitstr_t *markbs, |
u_int py, u_int nx, u_int ny, bitstr_t *mbs, const struct grid_cell *mgc) |
const struct grid_cell *markgc) |
|
{ |
{ |
struct screen *s = ctx->s; |
struct screen *s = ctx->s; |
struct grid *gd = src->grid; |
struct grid *gd = src->grid; |
|
|
for (yy = py; yy < py + ny; yy++) { |
for (yy = py; yy < py + ny; yy++) { |
for (xx = px; xx < px + nx; xx++) { |
for (xx = px; xx < px + nx; xx++) { |
grid_get_cell(gd, xx, yy, &gc); |
grid_get_cell(gd, xx, yy, &gc); |
if (markbs != NULL) { |
if (mbs != NULL) { |
b = (yy * screen_size_x(src)) + xx; |
b = (yy * screen_size_x(src)) + xx; |
if (bit_test(markbs, b)) { |
if (bit_test(mbs, b)) { |
gc.attr = markgc->attr; |
gc.attr = mgc->attr; |
gc.fg = markgc->fg; |
gc.fg = mgc->fg; |
gc.bg = markgc->bg; |
gc.bg = mgc->bg; |
} |
} |
} |
} |
screen_write_cell(ctx, &gc); |
screen_write_cell(ctx, &gc); |
} |
} |
|
|
cy++; |
cy++; |
screen_write_cursormove(ctx, cx, cy); |
screen_write_cursormove(ctx, cx, cy); |
} |
} |
} |
} |
|
|
|
/* |
|
* Copy from another screen but without the selection stuff. Also assumes the |
|
* target region is already big enough and already cleared. |
|
*/ |
|
void |
|
screen_write_fast_copy(struct screen_write_ctx *ctx, struct screen *src, |
|
u_int px, u_int py, u_int nx, u_int ny) |
|
{ |
|
struct screen *s = ctx->s; |
|
struct grid *gd = src->grid; |
|
struct grid_cell gc; |
|
u_int xx, yy, cx, cy; |
|
|
|
if (nx == 0 || ny == 0) |
|
return; |
|
|
|
cy = s->cy; |
|
for (yy = py; yy < py + ny; yy++) { |
|
cx = s->cx; |
|
for (xx = px; xx < px + nx; xx++) { |
|
if (xx >= gd->linedata[yy].cellsize) |
|
break; |
|
grid_get_cell(gd, xx, yy, &gc); |
|
if (!grid_cells_equal(&gc, &grid_default_cell)) |
|
grid_view_set_cell(ctx->s->grid, cx, cy, &gc); |
|
cx++; |
|
} |
|
cy++; |
|
} |
|
} |
|
|
/* Draw a horizontal line on screen. */ |
/* Draw a horizontal line on screen. */ |
void |
void |
screen_write_hline(struct screen_write_ctx *ctx, u_int nx, int left, int right) |
screen_write_hline(struct screen_write_ctx *ctx, u_int nx, int left, int right) |
|
|
screen_write_cursormove(ctx, cx, cy); |
screen_write_cursormove(ctx, cx, cy); |
} |
} |
|
|
/* Write a preview version of a window. */ |
/* |
|
* Write a preview version of a window. Assumes target area is big enough and |
|
* already cleared. |
|
*/ |
void |
void |
screen_write_preview(struct screen_write_ctx *ctx, struct screen *src, u_int nx, |
screen_write_preview(struct screen_write_ctx *ctx, struct screen *src, u_int nx, |
u_int ny) |
u_int ny) |
|
|
py = 0; |
py = 0; |
} |
} |
|
|
screen_write_copy(ctx, src, px, src->grid->hsize + py, nx, ny, NULL, |
screen_write_fast_copy(ctx, src, px, src->grid->hsize + py, nx, ny); |
NULL); |
|
|
|
if (src->mode & MODE_CURSOR) { |
if (src->mode & MODE_CURSOR) { |
grid_view_get_cell(src->grid, src->cx, src->cy, &gc); |
grid_view_get_cell(src->grid, src->cx, src->cy, &gc); |