=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.187 retrieving revision 1.188 diff -c -r1.187 -r1.188 *** src/usr.bin/tmux/tty.c 2015/09/02 17:43:25 1.187 --- src/usr.bin/tmux/tty.c 2015/09/25 23:30:12 1.188 *************** *** 1,4 **** ! /* $OpenBSD: tty.c,v 1.187 2015/09/02 17:43:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tty.c,v 1.188 2015/09/25 23:30:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 1648,1661 **** char s[32]; /* ! * If the terminfo entry has 256 colours, assume that setaf and setab ! * work correctly. */ if (tty->term->flags & TERM_256COLOURS) { ! if (*type == '3') tty_putcode1(tty, TTYC_SETAF, colour); ! else tty_putcode1(tty, TTYC_SETAB, colour); return (0); } --- 1648,1666 ---- char s[32]; /* ! * If the terminfo entry has 256 colours and setaf and setab exist, ! * assume that they work correctly. */ if (tty->term->flags & TERM_256COLOURS) { ! if (*type == '3') { ! if (!tty_term_has(tty->term, TTYC_SETAF)) ! goto fallback; tty_putcode1(tty, TTYC_SETAF, colour); ! } else { ! if (!tty_term_has(tty->term, TTYC_SETAB)) ! goto fallback; tty_putcode1(tty, TTYC_SETAB, colour); + } return (0); } *************** *** 1663,1675 **** * If the user has specified -2 to the client, setaf and setab may not * work, so send the usual sequence. */ ! if (tty->term_flags & TERM_256COLOURS) { ! xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour); ! tty_puts(tty, s); ! return (0); ! } return (-1); } void --- 1668,1682 ---- * If the user has specified -2 to the client, setaf and setab may not * work, so send the usual sequence. */ ! if (tty->term_flags & TERM_256COLOURS) ! goto fallback; return (-1); + + fallback: + xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour); + tty_puts(tty, s); + return (0); } void