diff options
author | Christoph Lohmann <20h@r-36.net> | 2013-03-29 19:01:24 +0100 |
---|---|---|
committer | Christoph Lohmann <20h@r-36.net> | 2013-03-29 19:01:24 +0100 |
commit | 7e7760c2ed1a6fc9d500da51bd8dc499fb36e1b0 (patch) | |
tree | ef717614006ac46fa1303f579e762d0b3a067a0b | |
parent | adde5c6d9dec3a0ab4d78b9d6e70b970ffb33a05 (diff) | |
download | st-patched-7e7760c2ed1a6fc9d500da51bd8dc499fb36e1b0.tar.bz2 st-patched-7e7760c2ed1a6fc9d500da51bd8dc499fb36e1b0.tar.xz st-patched-7e7760c2ed1a6fc9d500da51bd8dc499fb36e1b0.zip |
Add the possibility to have default highlight colors.
Thanks to stargrave@stargrave.org for the suggestion!
-rw-r--r-- | config.def.h | 8 | ||||
-rw-r--r-- | st.c | 32 |
2 files changed, 27 insertions, 13 deletions
diff --git a/config.def.h b/config.def.h index 75abefb..693bdbd 100644 --- a/config.def.h +++ b/config.def.h | |||
@@ -62,6 +62,14 @@ static unsigned int defaultbg = 0; | |||
62 | static unsigned int defaultcs = 256; | 62 | static unsigned int defaultcs = 256; |
63 | static unsigned int defaultucs = 257; | 63 | static unsigned int defaultucs = 257; |
64 | 64 | ||
65 | /* | ||
66 | * Colors used, when the specific fg == defaultfg. So in reverse mode this | ||
67 | * will reverse too. Another logic would only make the simple feature too | ||
68 | * complex. | ||
69 | */ | ||
70 | static unsigned int defaultitalic = 11; | ||
71 | static unsigned int defaultunderline = 7; | ||
72 | |||
65 | /* Internal shortcuts. */ | 73 | /* Internal shortcuts. */ |
66 | #define MODKEY Mod1Mask | 74 | #define MODKEY Mod1Mask |
67 | 75 | ||
@@ -2711,12 +2711,28 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
2711 | FcPattern *fcpattern, *fontpattern; | 2711 | FcPattern *fcpattern, *fontpattern; |
2712 | FcFontSet *fcsets[] = { NULL }; | 2712 | FcFontSet *fcsets[] = { NULL }; |
2713 | FcCharSet *fccharset; | 2713 | FcCharSet *fccharset; |
2714 | Colour *fg = &dc.col[base.fg], *bg = &dc.col[base.bg], | 2714 | Colour *fg, *bg, *temp, revfg, revbg; |
2715 | *temp, revfg, revbg; | ||
2716 | XRenderColor colfg, colbg; | 2715 | XRenderColor colfg, colbg; |
2717 | 2716 | ||
2718 | frcflags = FRC_NORMAL; | 2717 | frcflags = FRC_NORMAL; |
2719 | 2718 | ||
2719 | if(base.mode & ATTR_ITALIC) { | ||
2720 | if(base.fg == defaultfg) | ||
2721 | base.fg = defaultitalic; | ||
2722 | font = &dc.ifont; | ||
2723 | frcflags = FRC_ITALIC; | ||
2724 | } else if((base.mode & ATTR_ITALIC) && (base.mode & ATTR_BOLD)) { | ||
2725 | if(base.fg == defaultfg) | ||
2726 | base.fg = defaultitalic; | ||
2727 | font = &dc.ibfont; | ||
2728 | frcflags = FRC_ITALICBOLD; | ||
2729 | } else if(base.mode & ATTR_UNDERLINE) { | ||
2730 | if(base.fg == defaultfg) | ||
2731 | base.fg = defaultunderline; | ||
2732 | } | ||
2733 | fg = &dc.col[base.fg]; | ||
2734 | bg = &dc.col[base.bg]; | ||
2735 | |||
2720 | if(base.mode & ATTR_BOLD) { | 2736 | if(base.mode & ATTR_BOLD) { |
2721 | if(BETWEEN(base.fg, 0, 7)) { | 2737 | if(BETWEEN(base.fg, 0, 7)) { |
2722 | /* basic system colors */ | 2738 | /* basic system colors */ |
@@ -2738,15 +2754,6 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
2738 | frcflags = FRC_BOLD; | 2754 | frcflags = FRC_BOLD; |
2739 | } | 2755 | } |
2740 | 2756 | ||
2741 | if(base.mode & ATTR_ITALIC) { | ||
2742 | font = &dc.ifont; | ||
2743 | frcflags = FRC_ITALIC; | ||
2744 | } | ||
2745 | if((base.mode & ATTR_ITALIC) && (base.mode & ATTR_BOLD)) { | ||
2746 | font = &dc.ibfont; | ||
2747 | frcflags = FRC_ITALICBOLD; | ||
2748 | } | ||
2749 | |||
2750 | if(IS_SET(MODE_REVERSE)) { | 2757 | if(IS_SET(MODE_REVERSE)) { |
2751 | if(fg == &dc.col[defaultfg]) { | 2758 | if(fg == &dc.col[defaultfg]) { |
2752 | fg = &dc.col[defaultbg]; | 2759 | fg = &dc.col[defaultbg]; |
@@ -2873,8 +2880,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { | |||
2873 | FcTrue, fcpattern, &fcres); | 2880 | FcTrue, fcpattern, &fcres); |
2874 | 2881 | ||
2875 | /* | 2882 | /* |
2876 | * Overwrite or create the new cache entry | 2883 | * Overwrite or create the new cache entry. |
2877 | * entry. | ||
2878 | */ | 2884 | */ |
2879 | frccur++; | 2885 | frccur++; |
2880 | frclen++; | 2886 | frclen++; |