aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2013-03-29 19:01:24 +0100
committerChristoph Lohmann <20h@r-36.net>2013-03-29 19:01:24 +0100
commit7e7760c2ed1a6fc9d500da51bd8dc499fb36e1b0 (patch)
treeef717614006ac46fa1303f579e762d0b3a067a0b /st.c
parentadde5c6d9dec3a0ab4d78b9d6e70b970ffb33a05 (diff)
downloadst-7e7760c2ed1a6fc9d500da51bd8dc499fb36e1b0.tar.gz
st-7e7760c2ed1a6fc9d500da51bd8dc499fb36e1b0.tar.bz2
Add the possibility to have default highlight colors.
Thanks to stargrave@stargrave.org for the suggestion!
Diffstat (limited to 'st.c')
-rw-r--r--st.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/st.c b/st.c
index 599685c..8b1fc56 100644
--- a/st.c
+++ b/st.c
@@ -2711,12 +2711,28 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
FcPattern *fcpattern, *fontpattern;
FcFontSet *fcsets[] = { NULL };
FcCharSet *fccharset;
- Colour *fg = &dc.col[base.fg], *bg = &dc.col[base.bg],
- *temp, revfg, revbg;
+ Colour *fg, *bg, *temp, revfg, revbg;
XRenderColor colfg, colbg;
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(BETWEEN(base.fg, 0, 7)) {
/* basic system colors */
@@ -2738,15 +2754,6 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
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(fg == &dc.col[defaultfg]) {
fg = &dc.col[defaultbg];
@@ -2873,8 +2880,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
FcTrue, fcpattern, &fcres);
/*
- * Overwrite or create the new cache entry
- * entry.
+ * Overwrite or create the new cache entry.
*/
frccur++;
frclen++;