-/* $OpenBSD: tty-term.c,v 1.57 2017/08/27 08:33:55 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.58 2018/02/04 10:10:39 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
[TTYC_MS] = { TTYCODE_STRING, "Ms" },
[TTYC_OP] = { TTYCODE_STRING, "op" },
[TTYC_REV] = { TTYCODE_STRING, "rev" },
+ [TTYC_RGB] = { TTYCODE_FLAG, "RGB" },
[TTYC_RI] = { TTYCODE_STRING, "ri" },
[TTYC_RMACS] = { TTYCODE_STRING, "rmacs" },
[TTYC_RMCUP] = { TTYCODE_STRING, "rmcup" },
code->type = TTYCODE_STRING;
}
- /* On terminals with RGB colour (TC), fill in setrgbf and setrgbb. */
- if (tty_term_flag(term, TTYC_TC) &&
+ /*
+ * On terminals with RGB colour (Tc or RGB), fill in setrgbf and
+ * setrgbb if they are missing.
+ */
+ if ((tty_term_flag(term, TTYC_TC) || tty_term_flag(term, TTYC_RGB)) &&
!tty_term_has(term, TTYC_SETRGBF) &&
!tty_term_has(term, TTYC_SETRGBB)) {
code = &term->codes[TTYC_SETRGBF];
-/* $OpenBSD: tty.c,v 1.299 2018/01/16 17:03:18 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.300 2018/02/04 10:10:39 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
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;
/*
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);
}