version 1.167, 2020/04/16 21:46:43 |
version 1.168, 2020/04/17 15:44:58 |
|
|
u_int x; |
u_int x; |
int wrapped; |
int wrapped; |
|
|
enum { TEXT, CLEAR, CLEAR_END, CLEAR_START } type; |
enum { TEXT, CLEAR_END, CLEAR_START } type; |
u_int used; |
u_int used; |
union { |
union { |
u_int bg; |
u_int bg; |
|
|
TAILQ_ENTRY(screen_write_collect_item) entry; |
TAILQ_ENTRY(screen_write_collect_item) entry; |
}; |
}; |
struct screen_write_collect_line { |
struct screen_write_collect_line { |
|
u_int bg; |
TAILQ_HEAD(, screen_write_collect_item) items; |
TAILQ_HEAD(, screen_write_collect_item) items; |
}; |
}; |
|
|
|
|
void |
void |
screen_write_clearline(struct screen_write_ctx *ctx, u_int bg) |
screen_write_clearline(struct screen_write_ctx *ctx, u_int bg) |
{ |
{ |
struct screen *s = ctx->s; |
struct screen *s = ctx->s; |
struct grid_line *gl; |
struct grid_line *gl; |
u_int sx = screen_size_x(s); |
u_int sx = screen_size_x(s); |
struct screen_write_collect_item *ci = ctx->item; |
|
|
|
gl = grid_get_line(s->grid, s->grid->hsize + s->cy); |
gl = grid_get_line(s->grid, s->grid->hsize + s->cy); |
if (gl->cellsize == 0 && COLOUR_DEFAULT(bg)) |
if (gl->cellsize == 0 && COLOUR_DEFAULT(bg)) |
|
|
grid_view_clear(s->grid, 0, s->cy, sx, 1, bg); |
grid_view_clear(s->grid, 0, s->cy, sx, 1, bg); |
|
|
screen_write_collect_clear(ctx, s->cy, 1); |
screen_write_collect_clear(ctx, s->cy, 1); |
ci->x = 0; |
ctx->list[s->cy].bg = 1 + bg; |
ci->type = CLEAR; |
ctx->item->used = 0; |
ci->bg = bg; |
|
TAILQ_INSERT_TAIL(&ctx->list[s->cy].items, ci, entry); |
|
ctx->item = xcalloc(1, sizeof *ctx->item); |
|
} |
} |
|
|
/* Clear to end of line from cursor. */ |
/* Clear to end of line from cursor. */ |
|
|
return (0); |
return (0); |
TAILQ_FOREACH_SAFE(ci, &ctx->list[y].items, entry, tmp) { |
TAILQ_FOREACH_SAFE(ci, &ctx->list[y].items, entry, tmp) { |
switch (ci->type) { |
switch (ci->type) { |
case CLEAR: |
|
continue; |
|
case CLEAR_START: |
case CLEAR_START: |
if (ci->x >= x) { |
if (ci->x >= x) { |
if (ci->bg == bg) |
if (ci->bg == bg) |
|
|
return (0); |
return (0); |
TAILQ_FOREACH_SAFE(ci, &ctx->list[y].items, entry, tmp) { |
TAILQ_FOREACH_SAFE(ci, &ctx->list[y].items, entry, tmp) { |
switch (ci->type) { |
switch (ci->type) { |
case CLEAR: |
|
continue; |
|
case CLEAR_START: |
case CLEAR_START: |
if (ci->x >= x) |
if (ci->x >= x) |
ci->x = x; |
ci->x = x; |
|
|
|
|
cx = s->cx; cy = s->cy; |
cx = s->cx; cy = s->cy; |
for (y = 0; y < screen_size_y(s); y++) { |
for (y = 0; y < screen_size_y(s); y++) { |
|
if (ctx->list[y].bg != 0) { |
|
screen_write_set_cursor(ctx, 0, y); |
|
screen_write_initctx(ctx, &ttyctx, 1); |
|
ttyctx.bg = ctx->list[y].bg - 1; |
|
tty_write(tty_cmd_clearline, &ttyctx); |
|
} |
TAILQ_FOREACH_SAFE(ci, &ctx->list[y].items, entry, tmp) { |
TAILQ_FOREACH_SAFE(ci, &ctx->list[y].items, entry, tmp) { |
screen_write_set_cursor(ctx, ci->x, y); |
screen_write_set_cursor(ctx, ci->x, y); |
if (ci->type == CLEAR) { |
if (ci->type == CLEAR_END) { |
screen_write_initctx(ctx, &ttyctx, 1); |
|
ttyctx.bg = ci->bg; |
|
tty_write(tty_cmd_clearline, &ttyctx); |
|
} else if (ci->type == CLEAR_END) { |
|
screen_write_initctx(ctx, &ttyctx, 1); |
screen_write_initctx(ctx, &ttyctx, 1); |
ttyctx.bg = ci->bg; |
ttyctx.bg = ci->bg; |
tty_write(tty_cmd_clearendofline, &ttyctx); |
tty_write(tty_cmd_clearendofline, &ttyctx); |