--- st.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/st.c b/st.c index df660ff..accba74 100644 --- a/st.c +++ b/st.c _AT_@ -185,6 +185,7 @@ typedef struct { ushort mode; /* attribute flags */ uint32_t fg; /* foreground */ uint32_t bg; /* background */ + bool fgcustcolor; /* custom foreground color is in effect */ } Glyph; typedef Glyph *Line; _AT_@ -1703,6 +1704,7 @@ tsetattr(int *attr, int l) { | ATTR_BLINK); term.c.attr.fg = defaultfg; term.c.attr.bg = defaultbg; + term.c.attr.fgcustcolor = False; break; case 1: term.c.attr.mode |= ATTR_BOLD; _AT_@ -1738,11 +1740,14 @@ tsetattr(int *attr, int l) { term.c.attr.mode &= ~ATTR_REVERSE; break; case 38: - if ((idx = tdefcolor(attr, &i, l)) >= 0) + if ((idx = tdefcolor(attr, &i, l)) >= 0) { term.c.attr.fg = idx; + term.c.attr.fgcustcolor = True; + } break; case 39: term.c.attr.fg = defaultfg; + term.c.attr.fgcustcolor = False; break; case 48: if ((idx = tdefcolor(attr, &i, l)) >= 0) _AT_@ -1754,10 +1759,12 @@ tsetattr(int *attr, int l) { default: if(BETWEEN(attr[i], 30, 37)) { term.c.attr.fg = attr[i] - 30; + term.c.attr.fgcustcolor = True; } else if(BETWEEN(attr[i], 40, 47)) { term.c.attr.bg = attr[i] - 40; } else if(BETWEEN(attr[i], 90, 97)) { term.c.attr.fg = attr[i] - 90 + 8; + term.c.attr.fgcustcolor = True; } else if(BETWEEN(attr[i], 100, 107)) { term.c.attr.bg = attr[i] - 100 + 8; } else { _AT_@ -3153,15 +3160,17 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { } if(base.mode & ATTR_BOLD) { - if(BETWEEN(base.fg, 0, 7)) { - /* basic system colors */ - fg = &dc.col[base.fg + 8]; - } else if(BETWEEN(base.fg, 16, 195)) { - /* 256 colors */ - fg = &dc.col[base.fg + 36]; - } else if(BETWEEN(base.fg, 232, 251)) { - /* greyscale */ - fg = &dc.col[base.fg + 4]; + if (base.fgcustcolor) { + if(BETWEEN(base.fg, 0, 7)) { + /* basic system colors */ + fg = &dc.col[base.fg + 8]; + } else if(BETWEEN(base.fg, 16, 195)) { + /* 256 colors */ + fg = &dc.col[base.fg + 36]; + } else if(BETWEEN(base.fg, 232, 251)) { + /* greyscale */ + fg = &dc.col[base.fg + 4]; + } } /* * Those ranges will not be brightened: -- 1.9.2Received on Tue Apr 15 2014 - 16:39:19 CEST
This archive was generated by hypermail 2.3.0 : Tue Apr 15 2014 - 16:48:14 CEST