=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.62 retrieving revision 1.63 diff -c -r1.62 -r1.63 *** src/usr.bin/tmux/tty.c 2009/10/28 08:33:20 1.62 --- src/usr.bin/tmux/tty.c 2009/10/28 08:52:36 1.63 *************** *** 1,4 **** ! /* $OpenBSD: tty.c,v 1.62 2009/10/28 08:33:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tty.c,v 1.63 2009/10/28 08:52:36 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 1119,1128 **** void tty_attributes(struct tty *tty, const struct grid_cell *gc) { ! struct grid_cell *tc = &tty->cell; u_char changed; u_int fg = gc->fg, bg = gc->bg, attr = gc->attr; /* If any bits are being cleared, reset everything. */ if (tc->attr & ~attr) tty_reset(tty); --- 1119,1142 ---- void tty_attributes(struct tty *tty, const struct grid_cell *gc) { ! struct grid_cell *tc = &tty->cell, gc2; u_char changed; u_int fg = gc->fg, bg = gc->bg, attr = gc->attr; + /* If the character is space, don't care about foreground. */ + if (gc->data == ' ' && !(gc->flags & GRID_FLAG_UTF8)) { + memcpy(&gc2, gc, sizeof gc2); + + if (gc->attr & GRID_ATTR_REVERSE) + gc2.bg = tc->bg; + else + gc2.fg = tc->fg; + gc2.attr = tc->attr & ~GRID_ATTR_REVERSE; + gc2.attr |= gc->attr & GRID_ATTR_REVERSE; + + gc = &gc2; + } + /* If any bits are being cleared, reset everything. */ if (tc->attr & ~attr) tty_reset(tty); *************** *** 1185,1191 **** /* No changes? Nothing is necessary. */ if (fg == tc->fg && bg == tc->bg && ((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0) ! return; /* * Is either the default colour? This is handled specially because the --- 1199,1205 ---- /* No changes? Nothing is necessary. */ if (fg == tc->fg && bg == tc->bg && ((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0) ! return; /* * Is either the default colour? This is handled specially because the