version 1.106, 2017/02/08 08:50:10 |
version 1.107, 2017/02/08 15:41:41 |
|
|
if (nx == 0) |
if (nx == 0) |
return; |
return; |
|
|
|
if (s->cx > screen_size_x(s) - 1) |
|
return; |
|
|
screen_write_flush(ctx); |
screen_write_flush(ctx); |
screen_write_initctx(ctx, &ttyctx); |
screen_write_initctx(ctx, &ttyctx); |
|
ttyctx.bg = bg; |
|
|
if (s->cx <= screen_size_x(s) - 1) |
grid_view_insert_cells(s->grid, s->cx, s->cy, nx, bg); |
grid_view_insert_cells(s->grid, s->cx, s->cy, nx, bg); |
|
|
|
ttyctx.num = nx; |
ttyctx.num = nx; |
ttyctx.bg = bg; |
|
tty_write(tty_cmd_insertcharacter, &ttyctx); |
tty_write(tty_cmd_insertcharacter, &ttyctx); |
} |
} |
|
|
|
|
if (nx == 0) |
if (nx == 0) |
return; |
return; |
|
|
|
if (s->cx > screen_size_x(s) - 1) |
|
return; |
|
|
screen_write_flush(ctx); |
screen_write_flush(ctx); |
screen_write_initctx(ctx, &ttyctx); |
screen_write_initctx(ctx, &ttyctx); |
|
ttyctx.bg = bg; |
|
|
if (s->cx <= screen_size_x(s) - 1) |
grid_view_delete_cells(s->grid, s->cx, s->cy, nx, bg); |
grid_view_delete_cells(s->grid, s->cx, s->cy, nx, bg); |
|
|
|
ttyctx.num = nx; |
ttyctx.num = nx; |
ttyctx.bg = bg; |
|
tty_write(tty_cmd_deletecharacter, &ttyctx); |
tty_write(tty_cmd_deletecharacter, &ttyctx); |
} |
} |
|
|
|
|
if (nx == 0) |
if (nx == 0) |
return; |
return; |
|
|
|
if (s->cx > screen_size_x(s) - 1) |
|
return; |
|
|
screen_write_initctx(ctx, &ttyctx); |
screen_write_initctx(ctx, &ttyctx); |
|
|
if (s->cx <= screen_size_x(s) - 1) { |
screen_dirty_clear(s, s->cx, s->cy, s->cx + nx - 1, s->cy); |
screen_dirty_clear(s, s->cx, s->cy, s->cx + nx - 1, s->cy); |
grid_view_clear(s->grid, s->cx, s->cy, nx, 1, 8); |
grid_view_clear(s->grid, s->cx, s->cy, nx, 1, 8); |
|
} else |
|
return; |
|
|
|
ttyctx.num = nx; |
ttyctx.num = nx; |
tty_write(tty_cmd_clearcharacter, &ttyctx); |
tty_write(tty_cmd_clearcharacter, &ttyctx); |
|
|
screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg) |
screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg) |
{ |
{ |
struct screen *s = ctx->s; |
struct screen *s = ctx->s; |
|
struct grid *gd = s->grid; |
struct tty_ctx ttyctx; |
struct tty_ctx ttyctx; |
|
|
if (ny == 0) |
if (ny == 0) |
|
|
|
|
screen_write_flush(ctx); |
screen_write_flush(ctx); |
screen_write_initctx(ctx, &ttyctx); |
screen_write_initctx(ctx, &ttyctx); |
|
ttyctx.bg = bg; |
|
|
grid_view_insert_lines(s->grid, s->cy, ny, bg); |
grid_view_insert_lines(gd, s->cy, ny, bg); |
|
|
ttyctx.num = ny; |
ttyctx.num = ny; |
ttyctx.bg = bg; |
|
tty_write(tty_cmd_insertline, &ttyctx); |
tty_write(tty_cmd_insertline, &ttyctx); |
return; |
return; |
} |
} |
|
|
|
|
screen_write_flush(ctx); |
screen_write_flush(ctx); |
screen_write_initctx(ctx, &ttyctx); |
screen_write_initctx(ctx, &ttyctx); |
|
ttyctx.bg = bg; |
|
|
if (s->cy < s->rupper || s->cy > s->rlower) |
if (s->cy < s->rupper || s->cy > s->rlower) |
grid_view_insert_lines(s->grid, s->cy, ny, bg); |
grid_view_insert_lines(gd, s->cy, ny, bg); |
else { |
else |
grid_view_insert_lines_region(s->grid, s->rlower, s->cy, ny, |
grid_view_insert_lines_region(gd, s->rlower, s->cy, ny, bg); |
bg); |
|
} |
|
|
|
ttyctx.num = ny; |
ttyctx.num = ny; |
ttyctx.bg = bg; |
|
tty_write(tty_cmd_insertline, &ttyctx); |
tty_write(tty_cmd_insertline, &ttyctx); |
} |
} |
|
|
|
|
screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg) |
screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg) |
{ |
{ |
struct screen *s = ctx->s; |
struct screen *s = ctx->s; |
|
struct grid *gd = s->grid; |
struct tty_ctx ttyctx; |
struct tty_ctx ttyctx; |
|
|
if (ny == 0) |
if (ny == 0) |
|
|
|
|
screen_write_flush(ctx); |
screen_write_flush(ctx); |
screen_write_initctx(ctx, &ttyctx); |
screen_write_initctx(ctx, &ttyctx); |
|
ttyctx.bg = bg; |
|
|
grid_view_delete_lines(s->grid, s->cy, ny, bg); |
grid_view_delete_lines(gd, s->cy, ny, bg); |
|
|
ttyctx.num = ny; |
ttyctx.num = ny; |
ttyctx.bg = bg; |
|
tty_write(tty_cmd_deleteline, &ttyctx); |
tty_write(tty_cmd_deleteline, &ttyctx); |
return; |
return; |
} |
} |
|
|
|
|
screen_write_flush(ctx); |
screen_write_flush(ctx); |
screen_write_initctx(ctx, &ttyctx); |
screen_write_initctx(ctx, &ttyctx); |
|
ttyctx.bg = bg; |
|
|
if (s->cy < s->rupper || s->cy > s->rlower) |
if (s->cy < s->rupper || s->cy > s->rlower) |
grid_view_delete_lines(s->grid, s->cy, ny, bg); |
grid_view_delete_lines(gd, s->cy, ny, bg); |
else { |
else |
grid_view_delete_lines_region(s->grid, s->rlower, s->cy, ny, |
grid_view_delete_lines_region(gd, s->rlower, s->cy, ny, bg); |
bg); |
|
} |
|
|
|
ttyctx.num = ny; |
ttyctx.num = ny; |
ttyctx.bg = bg; |
|
tty_write(tty_cmd_deleteline, &ttyctx); |
tty_write(tty_cmd_deleteline, &ttyctx); |
} |
} |
|
|
|
|
screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg) |
screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg) |
{ |
{ |
struct screen *s = ctx->s; |
struct screen *s = ctx->s; |
|
struct grid *gd = s->grid; |
struct tty_ctx ttyctx; |
struct tty_ctx ttyctx; |
u_int sx = screen_size_x(s), sy = screen_size_y(s); |
u_int sx = screen_size_x(s), sy = screen_size_y(s); |
|
|
|
|
ttyctx.bg = bg; |
ttyctx.bg = bg; |
|
|
/* Scroll into history if it is enabled and clearing entire screen. */ |
/* Scroll into history if it is enabled and clearing entire screen. */ |
if (s->cx == 0 && s->cy == 0 && s->grid->flags & GRID_HISTORY) { |
if (s->cx == 0 && s->cy == 0 && gd->flags & GRID_HISTORY) { |
screen_dirty_clear(s, 0, 0, sx - 1, sy - 1); |
screen_dirty_clear(s, 0, 0, sx - 1, sy - 1); |
grid_view_clear_history(s->grid, bg); |
grid_view_clear_history(gd, bg); |
} else { |
} else { |
if (s->cx <= sx - 1) { |
if (s->cx <= sx - 1) { |
screen_dirty_clear(s, s->cx, s->cy, sx - 1, s->cy); |
screen_dirty_clear(s, s->cx, s->cy, sx - 1, s->cy); |
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1, |
grid_view_clear(gd, s->cx, s->cy, sx - s->cx, 1, bg); |
bg); |
|
} |
} |
screen_dirty_clear(s, 0, s->cy + 1, sx - 1, sy - 1); |
screen_dirty_clear(s, 0, s->cy + 1, sx - 1, sy - 1); |
grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1), |
grid_view_clear(gd, 0, s->cy + 1, sx, sy - (s->cy + 1), bg); |
bg); |
|
} |
} |
|
|
tty_write(tty_cmd_clearendofscreen, &ttyctx); |
tty_write(tty_cmd_clearendofscreen, &ttyctx); |
|
|
return (done); |
return (done); |
} |
} |
|
|
|
/* Set external clipboard. */ |
void |
void |
screen_write_setselection(struct screen_write_ctx *ctx, u_char *str, u_int len) |
screen_write_setselection(struct screen_write_ctx *ctx, u_char *str, u_int len) |
{ |
{ |
|
|
tty_write(tty_cmd_setselection, &ttyctx); |
tty_write(tty_cmd_setselection, &ttyctx); |
} |
} |
|
|
|
/* Write unmodified string. */ |
void |
void |
screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len) |
screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len) |
{ |
{ |