version 1.78, 2009/12/04 11:01:29 |
version 1.79, 2009/12/14 21:33:38 |
|
|
if (fg == tc->fg && bg == tc->bg && |
if (fg == tc->fg && bg == tc->bg && |
((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0) |
((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0) |
return; |
return; |
|
log_debug("fg was %hhu, now %hhu", tc->fg, fg); |
|
|
/* |
/* |
* Is either the default colour? This is handled specially because the |
* Is either the default colour? This is handled specially because the |
|
|
{ |
{ |
struct grid_cell *tc = &tty->cell; |
struct grid_cell *tc = &tty->cell; |
u_char fg = gc->fg; |
u_char fg = gc->fg; |
|
char s[32]; |
|
|
/* Is this a 256-colour colour? */ |
/* Is this a 256-colour colour? */ |
if (gc->flags & GRID_FLAG_FG256) { |
if (gc->flags & GRID_FLAG_FG256) { |
|
|
tty_reset(tty); /* turn off bold */ |
tty_reset(tty); /* turn off bold */ |
} |
} |
|
|
|
/* Is this an aixterm bright colour? */ |
|
if (fg >= 90 && fg <= 97) { |
|
/* 16 colour terminals or above only. */ |
|
if (tty_term_number(tty->term, TTYC_COLORS) >= 16) { |
|
xsnprintf(s, sizeof s, "\033[%dm", fg); |
|
tty_puts(tty, s); |
|
goto save_fg; |
|
} |
|
fg -= 90; |
|
(*attr) |= GRID_ATTR_BRIGHT; |
|
} |
|
|
/* Otherwise set the foreground colour. */ |
/* Otherwise set the foreground colour. */ |
tty_putcode1(tty, TTYC_SETAF, fg); |
tty_putcode1(tty, TTYC_SETAF, fg); |
|
|
|
|
{ |
{ |
struct grid_cell *tc = &tty->cell; |
struct grid_cell *tc = &tty->cell; |
u_char bg = gc->bg; |
u_char bg = gc->bg; |
|
char s[32]; |
|
|
/* Is this a 256-colour colour? */ |
/* Is this a 256-colour colour? */ |
if (gc->flags & GRID_FLAG_BG256) { |
if (gc->flags & GRID_FLAG_BG256) { |
|
|
bg = colour_256to16(bg); |
bg = colour_256to16(bg); |
if (bg & 8) |
if (bg & 8) |
bg &= 7; |
bg &= 7; |
|
} |
|
|
|
/* Is this an aixterm bright colour? */ |
|
if (bg >= 100 && bg <= 107) { |
|
/* 16 colour terminals or above only. */ |
|
if (tty_term_number(tty->term, TTYC_COLORS) >= 16) { |
|
xsnprintf(s, sizeof s, "\033[%dm", bg); |
|
tty_puts(tty, s); |
|
goto save_bg; |
|
} |
|
bg -= 100; |
|
/* no such thing as a bold background */ |
} |
} |
|
|
/* Otherwise set the background colour. */ |
/* Otherwise set the background colour. */ |