diff options
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 30 |
1 files changed, 19 insertions, 11 deletions
@@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.45 2008-09-26 07:23:21 nicm Exp $ */ +/* $Id: tty.c,v 1.46 2008-10-09 22:00:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -980,11 +980,14 @@ tty_attributes_fg(struct tty *tty, const struct grid_cell *gc) tty_puts(tty, s); return; } - - if (fg > 15) - fg = 8; - else if (fg > 7) - fg -= 8; + fg = colour_translate256(fg); + if (fg & 8) { + fg &= 7; + if (enter_bold_mode != NULL) + tty_puts(tty, enter_bold_mode); + tty->cell.attr |= GRID_ATTR_BRIGHT; + } else if (tty->cell.attr & GRID_ATTR_BRIGHT) + tty_reset(tty); } if (fg == 8 && @@ -1010,11 +1013,16 @@ tty_attributes_bg(struct tty *tty, const struct grid_cell *gc) tty_puts(tty, s); return; } - - if (bg > 15) - bg = 8; - else if (bg > 7) - bg -= 8; + bg = colour_translate256(bg); + if (bg & 8) { + /* + * Bold background; not sure how widely this is + * supported... + */ + xsnprintf(s, sizeof s, "\033[%hhum", 92 + bg); + tty_puts(tty, s); + return; + } } if (bg == 8 && |