mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 17:12:51 +02:00
Factor computation of fg/bg.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4943 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
6c0463fbf7
commit
14b9462ae4
1 changed files with 8 additions and 6 deletions
|
|
@ -270,6 +270,8 @@ void term_window_scroll(TERM_WINDOW *window, int count)
|
||||||
void term_set_color(TERM_WINDOW *window, int col)
|
void term_set_color(TERM_WINDOW *window, int col)
|
||||||
{
|
{
|
||||||
int set_normal;
|
int set_normal;
|
||||||
|
int fg = col & 0x0f;
|
||||||
|
int bg = (col & 0xf0) >> 4;
|
||||||
|
|
||||||
set_normal = ((col & ATTR_RESETFG) && last_fg != -1) ||
|
set_normal = ((col & ATTR_RESETFG) && last_fg != -1) ||
|
||||||
((col & ATTR_RESETBG) && last_bg != -1);
|
((col & ATTR_RESETBG) && last_bg != -1);
|
||||||
|
|
@ -297,10 +299,10 @@ void term_set_color(TERM_WINDOW *window, int col)
|
||||||
terminfo_set_standout(FALSE);
|
terminfo_set_standout(FALSE);
|
||||||
|
|
||||||
/* set foreground color */
|
/* set foreground color */
|
||||||
if ((col & 0x0f) != last_fg &&
|
if (fg != last_fg &&
|
||||||
((col & 0x0f) != 0 || (col & ATTR_RESETFG) == 0)) {
|
(fg != 0 || (col & ATTR_RESETFG) == 0)) {
|
||||||
if (term_use_colors) {
|
if (term_use_colors) {
|
||||||
last_fg = col & 0x0f;
|
last_fg = fg;
|
||||||
terminfo_set_fg(last_fg);
|
terminfo_set_fg(last_fg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -311,10 +313,10 @@ void term_set_color(TERM_WINDOW *window, int col)
|
||||||
if (col & ATTR_BLINK)
|
if (col & ATTR_BLINK)
|
||||||
current_term->set_blink(current_term);
|
current_term->set_blink(current_term);
|
||||||
|
|
||||||
if ((col & 0xf0) >> 4 != last_bg &&
|
if (bg != last_bg &&
|
||||||
((col & 0xf0) != 0 || (col & ATTR_RESETBG) == 0)) {
|
(bg != 0 || (col & ATTR_RESETBG) == 0)) {
|
||||||
if (term_use_colors) {
|
if (term_use_colors) {
|
||||||
last_bg = (col & 0xf0) >> 4;
|
last_bg = bg;
|
||||||
terminfo_set_bg(last_bg);
|
terminfo_set_bg(last_bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue