Add the possibility to have default highlight colors.

Thanks to stargrave@stargrave.org for the suggestion!
master
Christoph Lohmann 12 years ago
parent adde5c6d9d
commit 7e7760c2ed

@ -62,6 +62,14 @@ static unsigned int defaultbg = 0;
static unsigned int defaultcs = 256; static unsigned int defaultcs = 256;
static unsigned int defaultucs = 257; static unsigned int defaultucs = 257;
/*
* Colors used, when the specific fg == defaultfg. So in reverse mode this
* will reverse too. Another logic would only make the simple feature too
* complex.
*/
static unsigned int defaultitalic = 11;
static unsigned int defaultunderline = 7;
/* Internal shortcuts. */ /* Internal shortcuts. */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask

32
st.c

@ -2711,12 +2711,28 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
FcPattern *fcpattern, *fontpattern; FcPattern *fcpattern, *fontpattern;
FcFontSet *fcsets[] = { NULL }; FcFontSet *fcsets[] = { NULL };
FcCharSet *fccharset; FcCharSet *fccharset;
Colour *fg = &dc.col[base.fg], *bg = &dc.col[base.bg], Colour *fg, *bg, *temp, revfg, revbg;
*temp, revfg, revbg;
XRenderColor colfg, colbg; XRenderColor colfg, colbg;
frcflags = FRC_NORMAL; frcflags = FRC_NORMAL;
if(base.mode & ATTR_ITALIC) {
if(base.fg == defaultfg)
base.fg = defaultitalic;
font = &dc.ifont;
frcflags = FRC_ITALIC;
} else if((base.mode & ATTR_ITALIC) && (base.mode & ATTR_BOLD)) {
if(base.fg == defaultfg)
base.fg = defaultitalic;
font = &dc.ibfont;
frcflags = FRC_ITALICBOLD;
} else if(base.mode & ATTR_UNDERLINE) {
if(base.fg == defaultfg)
base.fg = defaultunderline;
}
fg = &dc.col[base.fg];
bg = &dc.col[base.bg];
if(base.mode & ATTR_BOLD) { if(base.mode & ATTR_BOLD) {
if(BETWEEN(base.fg, 0, 7)) { if(BETWEEN(base.fg, 0, 7)) {
/* basic system colors */ /* basic system colors */
@ -2738,15 +2754,6 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
frcflags = FRC_BOLD; frcflags = FRC_BOLD;
} }
if(base.mode & ATTR_ITALIC) {
font = &dc.ifont;
frcflags = FRC_ITALIC;
}
if((base.mode & ATTR_ITALIC) && (base.mode & ATTR_BOLD)) {
font = &dc.ibfont;
frcflags = FRC_ITALICBOLD;
}
if(IS_SET(MODE_REVERSE)) { if(IS_SET(MODE_REVERSE)) {
if(fg == &dc.col[defaultfg]) { if(fg == &dc.col[defaultfg]) {
fg = &dc.col[defaultbg]; fg = &dc.col[defaultbg];
@ -2873,8 +2880,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
FcTrue, fcpattern, &fcres); FcTrue, fcpattern, &fcres);
/* /*
* Overwrite or create the new cache entry * Overwrite or create the new cache entry.
* entry.
*/ */
frccur++; frccur++;
frclen++; frclen++;

Loading…
Cancel
Save