diff options
author | 2012-05-05 18:17:59 +0000 | |
---|---|---|
committer | 2012-05-05 18:17:59 +0000 | |
commit | 14b3ea80df34fdeb7b900f5a6d13f785d73e4c70 (patch) | |
tree | c6ef2f8a8c56eefca3af2b7d21602c018f8aa915 /usr.bin/tmux/tty.c | |
parent | Make unbind-key -a work with -t, based on a diff from Kazuhiko Sakaguchi. (diff) | |
download | wireguard-openbsd-14b3ea80df34fdeb7b900f5a6d13f785d73e4c70.tar.xz wireguard-openbsd-14b3ea80df34fdeb7b900f5a6d13f785d73e4c70.zip |
Pull CRA out into a separate function and add ERA, from Ailin Nemui.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r-- | usr.bin/tmux/tty.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index d6be1a6a119..3d9b22609db 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.129 2012/03/20 11:01:00 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.130 2012/05/05 18:17:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -44,6 +44,10 @@ void tty_colours_fg(struct tty *, const struct grid_cell *); void tty_colours_bg(struct tty *, const struct grid_cell *); int tty_large_region(struct tty *, const struct tty_ctx *); +void tty_cra_pane(struct tty *, + const struct tty_ctx *, u_int, u_int, u_int, u_int, u_int, u_int); +void tty_era_pane(struct tty *, + const struct tty_ctx *, u_int, u_int, u_int, u_int); void tty_redraw_region(struct tty *, const struct tty_ctx *); void tty_emulate_repeat( struct tty *, enum tty_code_code, enum tty_code_code, u_int); @@ -52,6 +56,8 @@ void tty_cell(struct tty *, #define tty_use_acs(tty) \ (tty_term_has(tty->term, TTYC_ACSC) && !((tty)->flags & TTY_UTF8)) +#define tty_use_rect(tty) \ + (tty->xterm_version > 270) void tty_init(struct tty *tty, int fd, char *term) @@ -690,6 +696,38 @@ tty_write( } void +tty_cra_pane(struct tty *tty, const struct tty_ctx *ctx, + u_int t, u_int l, u_int b, u_int r, u_int tt, u_int tl) +{ + char tmp[64]; + + snprintf(tmp, sizeof tmp, + "\033[%u;%u;%u;%u;1;%u;%u;1$v", + ctx->yoff + t + 1, + ctx->xoff + l + 1, + ctx->yoff + b + 1, + ctx->xoff + r + 1, + ctx->yoff + tt + 1, + ctx->xoff + tl + 1); + tty_puts(tty, tmp); +} + +void +tty_era_pane(struct tty *tty, const struct tty_ctx *ctx, + u_int t, u_int l, u_int b, u_int r) +{ + char tmp[64]; + + snprintf(tmp, sizeof tmp, + "\033[%u;%u;%u;%u$z", + ctx->yoff + t + 1, + ctx->xoff + l + 1, + ctx->yoff + b + 1, + ctx->xoff + r + 1); + tty_puts(tty, tmp); +} + +void tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; @@ -868,7 +906,6 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; - char tmp[64]; if (ctx->ocy != ctx->orlower) return; @@ -877,16 +914,10 @@ tty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx) !tty_term_has(tty->term, TTYC_CSR)) { if (tty_large_region(tty, ctx)) wp->flags |= PANE_REDRAW; - else if (tty->xterm_version > 270) { - snprintf(tmp, sizeof tmp, - "\033[%u;%u;%u;%u;1;%u;%u;1$v", - ctx->yoff + ctx->orupper + 2, - ctx->xoff + 1, - ctx->yoff + ctx->orlower + 1, - ctx->xoff + screen_size_x(s), - ctx->yoff + ctx->orupper + 1, - ctx->xoff + 1); - tty_puts(tty, tmp); + else if (tty_use_rect(tty)) { + tty_cra_pane (tty, ctx, ctx->orupper + 1, 0, + ctx->orlower, screen_size_x(s) - 1, + ctx->orupper, 0); tty_cmd_clearline(tty, ctx); } else tty_redraw_region(tty, ctx); |