diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-01-15 23:18:55 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2013-01-15 23:18:55 +0000 |
commit | 44f8e1caffce2e887682c3314ee22becc09e1d3c (patch) | |
tree | a63dd217894d16337ba0880077064fadc5e7077f /screen-write.c | |
parent | bc2e4a36df2023a738c433779ba8f1e08b6951fe (diff) | |
download | rtmux-44f8e1caffce2e887682c3314ee22becc09e1d3c.tar.gz rtmux-44f8e1caffce2e887682c3314ee22becc09e1d3c.tar.bz2 rtmux-44f8e1caffce2e887682c3314ee22becc09e1d3c.zip |
Implement ECH (erase character, CSI X). Reported by Christian Neukirchen.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/screen-write.c b/screen-write.c index ec7d741e..4d147b5b 100644 --- a/screen-write.c +++ b/screen-write.c @@ -649,6 +649,30 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx) tty_write(tty_cmd_deletecharacter, &ttyctx); } +/* Clear nx characters. */ +void +screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx) +{ + struct screen *s = ctx->s; + struct tty_ctx ttyctx; + + if (nx == 0) + nx = 1; + + if (nx > screen_size_x(s) - s->cx) + nx = screen_size_x(s) - s->cx; + if (nx == 0) + return; + + screen_write_initctx(ctx, &ttyctx, 0); + + if (s->cx <= screen_size_x(s) - 1) + grid_view_clear(s->grid, s->cx, s->cy, nx, 1); + + ttyctx.num = nx; + tty_write(tty_cmd_clearcharacter, &ttyctx); +} + /* Insert ny lines. */ void screen_write_insertline(struct screen_write_ctx *ctx, u_int ny) |