aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2018-02-04 12:02:24 +0000
committerThomas Adam <thomas@xteddy.org>2018-02-04 12:02:24 +0000
commit24abfb72eb090a431de07c114836d9464f0f03c1 (patch)
treefd2fe1ced5ac6a307307642742e39be0140674d4 /tty.c
parent4e4c5008792069b3c8b0562a2411583e89b04aed (diff)
parentfe7a871a23ada0c71fb0886ef99a356c67bf5c0d (diff)
downloadrtmux-24abfb72eb090a431de07c114836d9464f0f03c1.tar.gz
rtmux-24abfb72eb090a431de07c114836d9464f0f03c1.tar.bz2
rtmux-24abfb72eb090a431de07c114836d9464f0f03c1.zip
Merge branch 'obsd-master'
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tty.c b/tty.c
index 01208a25..b293d41d 100644
--- a/tty.c
+++ b/tty.c
@@ -2051,11 +2051,15 @@ tty_try_colour(struct tty *tty, int colour, const char *type)
if (colour & COLOUR_FLAG_256) {
/*
- * If the user has specified -2 to the client, setaf and setab
- * may not work (or they may not want to use them), so send the
- * usual sequence.
+ * If the user has specified -2 to the client (meaning
+ * TERM_256COLOURS is set), setaf and setab may not work (or
+ * they may not want to use them), so send the usual sequence.
+ *
+ * Also if RGB is set, setaf and setab do not support the 256
+ * colour palette so use the sequences directly there too.
*/
- if (tty->term_flags & TERM_256COLOURS)
+ if ((tty->term_flags & TERM_256COLOURS) ||
+ tty_term_has(tty->term, TTYC_RGB))
goto fallback_256;
/*
@@ -2096,6 +2100,7 @@ tty_try_colour(struct tty *tty, int colour, const char *type)
fallback_256:
xsnprintf(s, sizeof s, "\033[%s;5;%dm", type, colour & 0xff);
+ log_debug("%s: 256 colour fallback: %s", tty->client->name, s);
tty_puts(tty, s);
return (0);
}