/* Clear to end of screen from cursor. */ void screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg) { struct screen *s = ctx->s; struct tty_ctx ttyctx; u_int sx = screen_size_x(s), sy = screen_size_y(s); screen_write_initctx(ctx, &ttyctx); ttyctx.bg = bg; /* Scroll into history if it is enabled and clearing entire screen. */ if (s->cx == 0 && s->cy == 0 && s->grid->flags & GRID_HISTORY) { screen_dirty_clear(s, 0, 0, sx - 1, sy - 1); grid_view_clear_history(s->grid, bg); } else { if (s->cx <= sx - 1) { 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, bg); } 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), bg); } tty_write(tty_cmd_clearendofscreen, &ttyctx); }
/* Clear entire screen. */ void screen_write_clearscreen(struct screen_write_ctx *ctx) { struct screen *s = ctx->s; struct tty_ctx ttyctx; screen_write_initctx(ctx, &ttyctx, 0); /* Scroll into history if it is enabled. */ if (s->grid->flags & GRID_HISTORY) grid_view_clear_history(s->grid); else { grid_view_clear( s->grid, 0, 0, screen_size_x(s), screen_size_y(s)); } tty_write(tty_cmd_clearscreen, &ttyctx); }
/* Clear entire screen. */ void screen_write_clearscreen(struct screen_write_ctx *ctx) { struct screen *s = ctx->s; struct tty_ctx ttyctx; u_int sx = screen_size_x(s), sy = screen_size_y(s); screen_write_initctx(ctx, &ttyctx); screen_dirty_clear(s, 0, 0, sx - 1, sy - 1); /* Scroll into history if it is enabled. */ if (s->grid->flags & GRID_HISTORY) grid_view_clear_history(s->grid); else grid_view_clear(s->grid, 0, 0, sx, sy); tty_write(tty_cmd_clearscreen, &ttyctx); }
/* Clear to end of screen from cursor. */ void screen_write_clearendofscreen(struct screen_write_ctx *ctx) { struct screen *s = ctx->s; struct tty_ctx ttyctx; u_int sx, sy; screen_write_initctx(ctx, &ttyctx, 0); sx = screen_size_x(s); sy = screen_size_y(s); /* Scroll into history if it is enabled and clearing entire screen. */ if (s->cy == 0 && s->grid->flags & GRID_HISTORY) grid_view_clear_history(s->grid); else { if (s->cx <= sx - 1) grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1)); } tty_write(tty_cmd_clearendofscreen, &ttyctx); }