aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2023-01-27 23:04:47 +0000
committerJosh Rahm <rahm@google.com>2023-01-27 23:04:47 +0000
commite64dc03ff7b867826c7fc76d6fff210ad3382e33 (patch)
tree9cf71b02a7ee8f6d39ae1207201dc0745bdb8be5 /tty.c
parentfb15fd116097b98c1b839cfdc76a7d84e206e6d5 (diff)
parentf5af3cfb211c12897b15e3b5a3b29c4bbb0493a8 (diff)
downloadrtmux-e64dc03ff7b867826c7fc76d6fff210ad3382e33.tar.gz
rtmux-e64dc03ff7b867826c7fc76d6fff210ad3382e33.tar.bz2
rtmux-e64dc03ff7b867826c7fc76d6fff210ad3382e33.zip
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/tty.c b/tty.c
index 1f373821..c8a2a6ee 100644
--- a/tty.c
+++ b/tty.c
@@ -108,6 +108,7 @@ tty_init(struct tty *tty, struct client *c)
tty->cstyle = SCREEN_CURSOR_DEFAULT;
tty->ccolour = -1;
+ tty->fg = tty->bg = -1;
if (tcgetattr(c->fd, &tty->tio) != 0)
return (-1);
@@ -286,7 +287,6 @@ tty_open(struct tty *tty, char **cause)
evtimer_set(&tty->timer, tty_timer_callback, tty);
tty_start_tty(tty);
-
tty_keys_build(tty);
return (0);
@@ -299,9 +299,9 @@ tty_start_timer_callback(__unused int fd, __unused short events, void *data)
struct client *c = tty->client;
log_debug("%s: start timer fired", c->name);
- if ((tty->flags & (TTY_HAVEDA|TTY_HAVEXDA)) == 0)
+ if ((tty->flags & (TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA)) == 0)
tty_update_features(tty);
- tty->flags |= (TTY_HAVEDA|TTY_HAVEXDA);
+ tty->flags |= TTY_ALL_REQUEST_FLAGS;
}
void
@@ -341,6 +341,8 @@ tty_start_tty(struct tty *tty)
tty_puts(tty, "\033[?1000l\033[?1002l\033[?1003l");
tty_puts(tty, "\033[?1006l\033[?1005l");
}
+ if (tty_term_has(tty->term, TTYC_ENBP))
+ tty_putcode(tty, TTYC_ENBP);
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
evtimer_add(&tty->start_timer, &tv);
@@ -363,12 +365,18 @@ tty_send_requests(struct tty *tty)
return;
if (tty->term->flags & TERM_VT100LIKE) {
- if (~tty->flags & TTY_HAVEDA)
+ if (~tty->term->flags & TTY_HAVEDA)
+ tty_puts(tty, "\033[c");
+ if (~tty->flags & TTY_HAVEDA2)
tty_puts(tty, "\033[>c");
if (~tty->flags & TTY_HAVEXDA)
tty_puts(tty, "\033[>q");
+ if (~tty->flags & TTY_HAVEFG)
+ tty_puts(tty, "\033]10;?\033\\");
+ if (~tty->flags & TTY_HAVEBG)
+ tty_puts(tty, "\033]11;?\033\\");
} else
- tty->flags |= (TTY_HAVEDA|TTY_HAVEXDA);
+ tty->flags |= TTY_ALL_REQUEST_FLAGS;
}
void
@@ -411,8 +419,6 @@ tty_stop_tty(struct tty *tty)
else if (tty_term_has(tty->term, TTYC_SS))
tty_raw(tty, tty_term_string1(tty->term, TTYC_SS, 0));
}
- if (tty->mode & MODE_BRACKETPASTE)
- tty_raw(tty, tty_term_string(tty->term, TTYC_DSBP));
if (tty->ccolour != -1)
tty_raw(tty, tty_term_string(tty->term, TTYC_CR));
@@ -421,6 +427,8 @@ tty_stop_tty(struct tty *tty)
tty_raw(tty, "\033[?1000l\033[?1002l\033[?1003l");
tty_raw(tty, "\033[?1006l\033[?1005l");
}
+ if (tty_term_has(tty->term, TTYC_DSBP))
+ tty_raw(tty, tty_term_string(tty->term, TTYC_DSBP));
if (tty->term->flags & TERM_VT100LIKE)
tty_raw(tty, "\033[?7727l");
@@ -819,12 +827,6 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
else if (mode & MODE_MOUSE_STANDARD)
tty_puts(tty, "\033[?1000h");
}
- if (changed & MODE_BRACKETPASTE) {
- if (mode & MODE_BRACKETPASTE)
- tty_putcode(tty, TTYC_ENBP);
- else
- tty_putcode(tty, TTYC_DSBP);
- }
tty->mode = mode;
}
@@ -1626,13 +1628,20 @@ tty_write(void (*cmdfn)(struct tty *, const struct tty_ctx *),
if (ctx->set_client_cb == NULL)
return;
TAILQ_FOREACH(c, &clients, entry) {
- if (!tty_client_ready(c))
- continue;
- state = ctx->set_client_cb(ctx, c);
- if (state == -1)
- break;
- if (state == 0)
- continue;
+ if (ctx->allow_invisible_panes) {
+ if (c->session == NULL ||
+ c->tty.term == NULL ||
+ c->flags & CLIENT_SUSPENDED)
+ continue;
+ } else {
+ if (!tty_client_ready(c))
+ continue;
+ state = ctx->set_client_cb(ctx, c);
+ if (state == -1)
+ break;
+ if (state == 0)
+ continue;
+ }
cmdfn(&c->tty, ctx);
}
}
@@ -2683,12 +2692,14 @@ tty_check_fg(struct tty *tty, struct colour_palette *palette,
/*
* Perform substitution if this pane has a palette. If the bright
- * attribute is set, use the bright entry in the palette by changing to
- * the aixterm colour.
+ * attribute is set and Nobr is not present, use the bright entry in
+ * the palette by changing to the aixterm colour
*/
if (~gc->flags & GRID_FLAG_NOPALETTE) {
c = gc->fg;
- if (c < 8 && gc->attr & GRID_ATTR_BRIGHT)
+ if (c < 8 &&
+ gc->attr & GRID_ATTR_BRIGHT &&
+ !tty_term_has(tty->term, TTYC_NOBR))
c += 90;
if ((c = colour_palette_get(palette, c)) != -1)
gc->fg = c;