summaryrefslogtreecommitdiff
path: root/src/fe-text/term-terminfo.c
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2008-12-05 13:55:23 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2008-12-05 13:55:23 +0000
commit14b9462ae4168e18421a6c49d906fd1ae9abb778 (patch)
tree33594f522a6baa3415e2bca5b93e39d4e03098fb /src/fe-text/term-terminfo.c
parent6c0463fbf7a2855fa8a248bd5a7f2b4a66aa4ed0 (diff)
downloadirssi-14b9462ae4168e18421a6c49d906fd1ae9abb778.zip
Factor computation of fg/bg.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4943 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/term-terminfo.c')
-rw-r--r--src/fe-text/term-terminfo.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index bc8a1868..ba1c2cbc 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -270,6 +270,8 @@ void term_window_scroll(TERM_WINDOW *window, int count)
void term_set_color(TERM_WINDOW *window, int col)
{
int set_normal;
+ int fg = col & 0x0f;
+ int bg = (col & 0xf0) >> 4;
set_normal = ((col & ATTR_RESETFG) && last_fg != -1) ||
((col & ATTR_RESETBG) && last_bg != -1);
@@ -297,10 +299,10 @@ void term_set_color(TERM_WINDOW *window, int col)
terminfo_set_standout(FALSE);
/* set foreground color */
- if ((col & 0x0f) != last_fg &&
- ((col & 0x0f) != 0 || (col & ATTR_RESETFG) == 0)) {
+ if (fg != last_fg &&
+ (fg != 0 || (col & ATTR_RESETFG) == 0)) {
if (term_use_colors) {
- last_fg = col & 0x0f;
+ last_fg = fg;
terminfo_set_fg(last_fg);
}
}
@@ -311,10 +313,10 @@ void term_set_color(TERM_WINDOW *window, int col)
if (col & ATTR_BLINK)
current_term->set_blink(current_term);
- if ((col & 0xf0) >> 4 != last_bg &&
- ((col & 0xf0) != 0 || (col & ATTR_RESETBG) == 0)) {
+ if (bg != last_bg &&
+ (bg != 0 || (col & ATTR_RESETBG) == 0)) {
if (term_use_colors) {
- last_bg = (col & 0xf0) >> 4;
+ last_bg = bg;
terminfo_set_bg(last_bg);
}
}