=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.58 retrieving revision 1.59 diff -c -r1.58 -r1.59 *** src/usr.bin/tmux/tty.c 2009/10/21 19:27:09 1.58 --- src/usr.bin/tmux/tty.c 2009/10/25 21:11:21 1.59 *************** *** 1,4 **** ! /* $OpenBSD: tty.c,v 1.58 2009/10/21 19:27:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tty.c,v 1.59 2009/10/25 21:11:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 1236,1248 **** tty_reset(tty); } ! if (fg == 8 && ! !(tty->term->flags & TERM_HASDEFAULTS) && ! !(tty->term_flags & TERM_HASDEFAULTS)) ! fg = 7; ! if (fg == 8) ! tty_puts(tty, "\033[39m"); ! else tty_putcode1(tty, TTYC_SETAF, fg); } --- 1236,1256 ---- tty_reset(tty); } ! if (fg == 8) { ! if (tty_term_has(tty->term, TTYC_AX)) { ! /* AX is an extension that means \033[39m works. */ ! tty_puts(tty, "\033[39m"); ! } else if (tty_term_has(tty->term, TTYC_OP)) { ! /* ! * op can be used to look for default colours but there ! * is no point in using it - with some terminals it ! * does SGR0 and others not, so SGR0 is needed anyway ! * to put the terminal into a known state. ! */ ! tty_reset(tty); ! } else ! tty_putcode1(tty, TTYC_SETAF, 7); ! } else tty_putcode1(tty, TTYC_SETAF, fg); } *************** *** 1262,1273 **** bg &= 7; } ! if (bg == 8 && ! !(tty->term->flags & TERM_HASDEFAULTS) && ! !(tty->term_flags & TERM_HASDEFAULTS)) ! bg = 0; ! if (bg == 8) ! tty_puts(tty, "\033[49m"); ! else tty_putcode1(tty, TTYC_SETAB, bg); } --- 1270,1282 ---- bg &= 7; } ! if (bg == 8) { ! if (tty_term_has(tty->term, TTYC_AX)) { ! tty_puts(tty, "\033[49m"); ! } else if (tty_term_has(tty->term, TTYC_OP)) ! tty_reset(tty); ! else ! tty_putcode1(tty, TTYC_SETAB, 0); ! } else tty_putcode1(tty, TTYC_SETAB, bg); }