aboutsummaryrefslogtreecommitdiff
path: root/local.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-11-12 20:29:43 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-11-12 20:29:43 +0000
commitdc8fb1e1dc72e96aeae151487a2d0ddd031801a9 (patch)
tree48eda0693f8e07fe3f58913aa86b2dbcf188d7fc /local.c
parenta3c89d76710cd09bdc7b3774f547576c13d8159c (diff)
downloadrtmux-dc8fb1e1dc72e96aeae151487a2d0ddd031801a9.tar.gz
rtmux-dc8fb1e1dc72e96aeae151487a2d0ddd031801a9.tar.bz2
rtmux-dc8fb1e1dc72e96aeae151487a2d0ddd031801a9.zip
Force default colours if terminal supports it.
Diffstat (limited to 'local.c')
-rw-r--r--local.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/local.c b/local.c
index 62abab55..2d19a716 100644
--- a/local.c
+++ b/local.c
@@ -1,4 +1,4 @@
-/* $Id: local.c,v 1.18 2007-11-08 10:39:52 nicm Exp $ */
+/* $Id: local.c,v 1.19 2007-11-12 20:29:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -766,23 +766,33 @@ local_attributes(u_char attr, u_char colr)
fg = (colr >> 4) & 0xf;
if (fg != ((local_colr >> 4) & 0xf)) {
- if (fg == 8) {
- if (tigetflag("AX") == TRUE)
- local_putp("\e[39m");
- else if (set_a_foreground != NULL)
- local_putp(tparm(set_a_foreground, 7));
- } else if (set_a_foreground != NULL)
+ if (tigetflag("AX") == TRUE) {
+ if (fg == 7)
+ fg = 8;
+ } else {
+ if (fg == 8)
+ fg = 7;
+ }
+
+ if (fg == 8)
+ local_putp("\e[39m");
+ else if (set_a_foreground != NULL)
local_putp(tparm(set_a_foreground, fg));
}
bg = colr & 0xf;
if (bg != (local_colr & 0xf)) {
- if (bg == 8) {
- if (tigetflag("AX") == TRUE)
- local_putp("\e[49m");
- else if (set_a_background != NULL)
- local_putp(tparm(set_a_background, 0));
- } else if (set_a_background != NULL)
+ if (tigetflag("AX") == TRUE) {
+ if (bg == 0)
+ bg = 8;
+ } else {
+ if (bg == 8)
+ bg = 0;
+ }
+
+ if (bg == 8)
+ local_putp("\e[49m");
+ else if (set_a_background != NULL)
local_putp(tparm(set_a_background, bg));
}