summaryrefslogtreecommitdiffstats
path: root/main/irssi/irssi-italics.patch
blob: 27763bd9ef8c6f939aa99be6a77ea74981dd7bb1 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
--- irssi-0.8.15/src/fe-common/core/fe-messages.c
+++ irssi-b/src/fe-common/core/fe-messages.c
@@ -64,8 +64,12 @@
 
 		if (*bgn == '*') 
 			type = 2; /* bold */
-		else if (*bgn == '_') 
+		else if (*bgn == '_')
 			type = 31; /* underlined */
+                /* XXX: irssi does not support 'true' italics at this time. */
+                else if (settings_get_bool("emphasis_underline_slashes") &&
+                        (*bgn == '/'))
+                        type = 31; /* italics */
 		else
 			continue;
 
@@ -76,7 +80,8 @@
 		if ((end = strchr(bgn+1, *bgn)) == NULL)
 			continue;
 		if (!ishighalnum(end[-1]) || ishighalnum(end[1]) ||
-		    end[1] == type || end[1] == '*' || end[1] == '_')
+		    end[1] == type || end[1] == '*' || end[1] == '_' ||
+                    end[1] == '/')
 			continue;
 
 		if (IS_CHANNEL(item)) {
@@ -643,6 +648,7 @@
 	settings_add_bool("lookandfeel", "emphasis", TRUE);
 	settings_add_bool("lookandfeel", "emphasis_replace", FALSE);
 	settings_add_bool("lookandfeel", "emphasis_multiword", FALSE);
+        settings_add_bool("lookandfeel", "emphasis_underline_slashes", FALSE);
 	settings_add_bool("lookandfeel", "show_nickmode", TRUE);
 	settings_add_bool("lookandfeel", "show_nickmode_empty", TRUE);
 	settings_add_bool("lookandfeel", "print_active_channel", FALSE);
--- irssi-0.8.15/src/fe-common/core/formats.c
+++ irssi-b/src/fe-common/core/formats.c
@@ -118,6 +118,10 @@
 		g_string_append_c(out, 4);
 		g_string_append_c(out, FORMAT_STYLE_UNDERLINE);
 		break;
+        case 'I':
+                /* italics on/off */
+                g_string_append_c(out, 4);
+                g_string_append_c(out, FORMAT_STYLE_ITALIC);
 	case '9':
 	case '_':
 		/* bold on/off */
@@ -832,7 +836,7 @@
 
 #define IS_COLOR_CODE(c) \
 	((c) == 2 || (c) == 3 || (c) == 4 || (c) == 6 || (c) == 7 || \
-	(c) == 15 || (c) == 22 || (c) == 27 || (c) == 31)
+	(c) == 15 || (c) == 22 || (c) == 27 || (c) == 29 || (c) == 31)
 
 /* Return how many characters in `str' must be skipped before `len'
    characters of text is skipped. */
@@ -1001,6 +1005,9 @@
 			case FORMAT_STYLE_UNDERLINE:
 				flags ^= GUI_PRINT_FLAG_UNDERLINE;
 				break;
+                        case FORMAT_STYLE_ITALIC:
+                                flags ^= GUI_PRINT_FLAG_ITALIC;
+                                break;
 			case FORMAT_STYLE_BOLD:
 				flags ^= GUI_PRINT_FLAG_BOLD;
 				break;
@@ -1050,6 +1057,7 @@
 			if (!hide_text_style)
 				flags ^= GUI_PRINT_FLAG_REVERSE;
 			break;
+                case 29: /* italics */
 		case 31:
 			/* underline */
 			if (!hide_text_style)
--- irssi-0.8.15/src/fe-common/core/formats.h
+++ irssi-b/src/fe-common/core/formats.h
@@ -7,9 +7,10 @@
 #define GUI_PRINT_FLAG_BOLD          0x0001
 #define GUI_PRINT_FLAG_REVERSE       0x0002
 #define GUI_PRINT_FLAG_UNDERLINE     0x0004
-#define GUI_PRINT_FLAG_BLINK         0x0008
-#define GUI_PRINT_FLAG_MIRC_COLOR    0x0010
-#define GUI_PRINT_FLAG_INDENT        0x0020
+#define GUI_PRINT_FLAG_ITALIC        0x0008
+#define GUI_PRINT_FLAG_BLINK         0x0010
+#define GUI_PRINT_FLAG_MIRC_COLOR    0x0020
+#define GUI_PRINT_FLAG_INDENT        0x0040
 #define GUI_PRINT_FLAG_NEWLINE       0x0080
 #define GUI_PRINT_FLAG_CLRTOEOL      0x0100
 #define GUI_PRINT_FLAG_MONOSPACE     0x0200
@@ -126,8 +127,9 @@
 #define FORMAT_STYLE_BLINK	(0x01 + FORMAT_STYLE_SPECIAL)
 #define FORMAT_STYLE_UNDERLINE	(0x02 + FORMAT_STYLE_SPECIAL)
 #define FORMAT_STYLE_BOLD	(0x03 + FORMAT_STYLE_SPECIAL)
-#define FORMAT_STYLE_REVERSE	(0x04 + FORMAT_STYLE_SPECIAL)
-#define FORMAT_STYLE_INDENT	(0x05 + FORMAT_STYLE_SPECIAL)
+#define FORMAT_STYLE_ITALIC     (0x04 + FORMAT_STYLE_SPECIAL)
+#define FORMAT_STYLE_REVERSE	(0x05 + FORMAT_STYLE_SPECIAL)
+#define FORMAT_STYLE_INDENT	(0x06 + FORMAT_STYLE_SPECIAL)
 #define FORMAT_STYLE_DEFAULTS	(0x07 + FORMAT_STYLE_SPECIAL)
 #define FORMAT_STYLE_CLRTOEOL	(0x08 + FORMAT_STYLE_SPECIAL)
 #define FORMAT_STYLE_MONOSPACE	(0x09 + FORMAT_STYLE_SPECIAL)
--- irssi-0.8.15/src/fe-text/gui-printtext.c
+++ irssi-b/src/fe-text/gui-printtext.c
@@ -157,6 +157,7 @@
 	if (flags & GUI_PRINT_FLAG_REVERSE) *attr |= ATTR_REVERSE;
 	if (flags & GUI_PRINT_FLAG_BOLD) *attr |= ATTR_BOLD;
 	if (flags & GUI_PRINT_FLAG_UNDERLINE) *attr |= ATTR_UNDERLINE;
+        if (flags & GUI_PRINT_FLAG_ITALIC) *attr |= ATTR_UNDERLINE;
 	if (flags & GUI_PRINT_FLAG_BLINK) *attr |= ATTR_BLINK;
 }