From f1193b48910aed15a2c73cdb5784a26f2ea0f64c Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 9 Nov 2020 10:54:28 +0000 Subject: If mouse bits change, clear them all and set again to avoid problems with some bits implying others. GitHub issue 2458. --- tty.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index bcbccca6..777b639b 100644 --- a/tty.c +++ b/tty.c @@ -694,28 +694,26 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s) } if ((changed & ALL_MOUSE_MODES) && tty_term_has(tty->term, TTYC_KMOUS)) { - if ((mode & ALL_MOUSE_MODES) == 0) + /* + * If the mouse modes have changed, clear any that are set and + * apply again. There are differences in how terminals track + * the various bits. + */ + if (tty->mode & MODE_MOUSE_SGR) tty_puts(tty, "\033[?1006l"); - if ((changed & MODE_MOUSE_STANDARD) && - (~mode & MODE_MOUSE_STANDARD)) + if (tty->mode & MODE_MOUSE_STANDARD) tty_puts(tty, "\033[?1000l"); - if ((changed & MODE_MOUSE_BUTTON) && - (~mode & MODE_MOUSE_BUTTON)) + if (tty->mode & MODE_MOUSE_BUTTON) tty_puts(tty, "\033[?1002l"); - if ((changed & MODE_MOUSE_ALL) && - (~mode & MODE_MOUSE_ALL)) + if (tty->mode & MODE_MOUSE_ALL) tty_puts(tty, "\033[?1003l"); - if (mode & ALL_MOUSE_MODES) tty_puts(tty, "\033[?1006h"); - if ((changed & MODE_MOUSE_STANDARD) && - (mode & MODE_MOUSE_STANDARD)) + if (mode & MODE_MOUSE_STANDARD) tty_puts(tty, "\033[?1000h"); - if ((changed & MODE_MOUSE_BUTTON) && - (mode & MODE_MOUSE_BUTTON)) + if (mode & MODE_MOUSE_BUTTON) tty_puts(tty, "\033[?1002h"); - if ((changed & MODE_MOUSE_ALL) && - (mode & MODE_MOUSE_ALL)) + if (mode & MODE_MOUSE_ALL) tty_puts(tty, "\033[?1003h"); } if (changed & MODE_BRACKETPASTE) { -- cgit From fd451aa7962f399250fd166f207451fcf4b9cb94 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 3 Dec 2020 07:12:11 +0000 Subject: Redraw any visible modes when status line changes so that formats like the pane title are updated. GitHub issue 2487. Also a man page fix from jmc. --- tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index 777b639b..fac7a99e 100644 --- a/tty.c +++ b/tty.c @@ -2447,7 +2447,7 @@ tty_check_fg(struct tty *tty, int *palette, struct grid_cell *gc) /* Is this a 256-colour colour? */ if (gc->fg & COLOUR_FLAG_256) { /* And not a 256 colour mode? */ - if (colours != 256) { + if (colours < 256) { gc->fg = colour_256to16(gc->fg); if (gc->fg & 8) { gc->fg &= 7; @@ -2500,7 +2500,7 @@ tty_check_bg(struct tty *tty, int *palette, struct grid_cell *gc) * palette. Bold background doesn't exist portably, so just * discard the bold bit if set. */ - if (colours != 256) { + if (colours < 256) { gc->bg = colour_256to16(gc->bg); if (gc->bg & 8) { gc->bg &= 7; -- cgit From 91d112bf12789da07e25ed001f7961b1d6bd7a76 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 18 Jan 2021 10:27:54 +0000 Subject: There is no need to clear every line entirely before drawing to it, this means moving the cursor and messes up wrapping. Better to just clear the sections that aren't written over. GitHub issue 2537. --- tty.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index fac7a99e..279bafaf 100644 --- a/tty.c +++ b/tty.c @@ -1531,20 +1531,9 @@ tty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx) void tty_cmd_clearcharacter(struct tty *tty, const struct tty_ctx *ctx) { - if (ctx->bigger) { - tty_draw_pane(tty, ctx, ctx->ocy); - return; - } - tty_default_attributes(tty, &ctx->defaults, ctx->palette, ctx->bg); - tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); - - if (tty_term_has(tty->term, TTYC_ECH) && - !tty_fake_bce(tty, &ctx->defaults, 8)) - tty_putcode1(tty, TTYC_ECH, ctx->num); - else - tty_repeat_space(tty, ctx->num); + tty_clear_pane_line(tty, ctx, ctx->ocy, ctx->ocx, ctx->num, ctx->bg); } void -- cgit From af3ffa9c41936078d27b5ba1f96cec67850f98cb Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 17 Feb 2021 07:18:36 +0000 Subject: Move the call to setupterm() into the client and have it pass the results to the server over imsg, means the server does not need to enter ncurses or read terminfo db. Old clients will not work with a new server. --- tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index 279bafaf..399bbae8 100644 --- a/tty.c +++ b/tty.c @@ -249,8 +249,8 @@ tty_open(struct tty *tty, char **cause) { struct client *c = tty->client; - tty->term = tty_term_create(tty, c->term_name, &c->term_features, - c->fd, cause); + tty->term = tty_term_create(tty, c->term_name, c->term_caps, + c->term_ncaps, &c->term_features, cause); if (tty->term == NULL) { tty_close(tty); return (-1); -- cgit