summaryrefslogtreecommitdiff
path: root/st-bright-bold-text.patch
blob: 0640f07b4682ba5803ef7f9e8dbcfb6f89db933b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--- a/config.def.h
+++ b/config.def.h
@@ -114,9 +114,10 @@ static const char *colorname[] = {
 
 /*
  * Default colors (colorname index)
- * foreground, background, cursor, reverse cursor
+ * foreground, default color for bold text, background, cursor, reverse cursor
  */
 unsigned int defaultfg = 7;
+unsigned int defaultbd = 15;
 unsigned int defaultbg = 0;
 static unsigned int defaultcs = 256;
 static unsigned int defaultrcs = 257;
--- a/st.c
+++ b/st.c
@@ -1378,9 +1378,12 @@ tsetattr(int *attr, int l)
 				ATTR_STRUCK     );
 			term.c.attr.fg = defaultfg;
 			term.c.attr.bg = defaultbg;
+			term.c.attr.colored = 0;
 			break;
 		case 1:
 			term.c.attr.mode |= ATTR_BOLD;
+			if (!term.c.attr.colored)
+				term.c.attr.fg = defaultbd;
 			break;
 		case 2:
 			term.c.attr.mode |= ATTR_FAINT;
@@ -1427,11 +1430,14 @@ tsetattr(int *attr, int l)
 			term.c.attr.mode &= ~ATTR_STRUCK;
 			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.colored = 1;
+			}
 			break;
 		case 39:
 			term.c.attr.fg = defaultfg;
+			term.c.attr.colored = 0;
 			break;
 		case 48:
 			if ((idx = tdefcolor(attr, &i, l)) >= 0)
@@ -1443,10 +1449,12 @@ tsetattr(int *attr, int l)
 		default:
 			if (BETWEEN(attr[i], 30, 37)) {
 				term.c.attr.fg = attr[i] - 30;
+				term.c.attr.colored = 1;
 			} 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.colored = 1;
 			} else if (BETWEEN(attr[i], 100, 107)) {
 				term.c.attr.bg = attr[i] - 100 + 8;
 			} else {
--- a/st.h
+++ b/st.h
@@ -65,6 +65,7 @@ typedef struct {
 	ushort mode;      /* attribute flags */
 	uint32_t fg;      /* foreground  */
 	uint32_t bg;      /* background  */
+	int colored;      /* tell if the text color set explicitly */
 } Glyph;
 
 typedef Glyph *Line;
@@ -119,4 +120,5 @@ extern int allowaltscreen;
 extern char *termname;
 extern unsigned int tabspaces;
 extern unsigned int defaultfg;
+extern unsigned int defaultbd;
 extern unsigned int defaultbg;