Browse Source

initial commit with a set of patches I plan to keep and maintain

master
Von Random 5 months ago
commit
143bbcc77e
8 changed files with 1187 additions and 0 deletions
  1. 480
    0
      config.h
  2. 30
    0
      makest.sh
  3. 517
    0
      st-boxdraw.patch
  4. 74
    0
      st-bright-bold-text.patch
  5. 17
    0
      st-config-mk.patch
  6. 45
    0
      st-disable-bold-italic-fonts.patch
  7. 13
    0
      st-disable-intensity-styles.patch
  8. 11
    0
      st-fix-argv.patch

+ 480
- 0
config.h View File

@@ -0,0 +1,480 @@
1
+/* See LICENSE file for copyright and license details. */
2
+
3
+/*
4
+ * appearance
5
+ *
6
+ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
7
+ */
8
+static char *font = "xos4 Terminus:bold:pixelsize=14";
9
+static int borderpx = 1;
10
+
11
+/* disable bold and italic font styles */
12
+int disablebold = 1;
13
+int disableitalic = 1;
14
+
15
+/*
16
+ * What program is execed by st depends of these precedence rules:
17
+ * 1: program passed with -e
18
+ * 2: utmp option
19
+ * 3: SHELL environment variable
20
+ * 4: value of shell in /etc/passwd
21
+ * 5: value of shell in config.h
22
+ */
23
+static char *shell = "/bin/sh";
24
+char *utmp = NULL;
25
+char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
26
+
27
+/* identification sequence returned in DA and DECID */
28
+char *vtiden = "\033[?6c";
29
+
30
+/* Kerning / character bounding-box multipliers */
31
+static float cwscale = 1.0;
32
+static float chscale = 1.0;
33
+
34
+/*
35
+ * word delimiter string
36
+ *
37
+ * More advanced example: " `'\"()[]{}"
38
+ */
39
+char *worddelimiters = " `'\"()[]{};|";
40
+
41
+/* selection timeouts (in milliseconds) */
42
+static unsigned int doubleclicktimeout = 300;
43
+static unsigned int tripleclicktimeout = 600;
44
+
45
+/* alt screens */
46
+int allowaltscreen = 1;
47
+
48
+/* frames per second st should at maximum draw to the screen */
49
+static unsigned int xfps = 60;
50
+static unsigned int actionfps = 30;
51
+
52
+/*
53
+ * blinking timeout (set to 0 to disable blinking) for the terminal blinking
54
+ * attribute.
55
+ */
56
+static unsigned int blinktimeout = 0;
57
+
58
+/*
59
+ * thickness of underline and bar cursors
60
+ */
61
+static unsigned int cursorthickness = 1;
62
+
63
+/*
64
+ * 1: custom-draw (without using the font) most of the lines/blocks characters
65
+ *    for gapless alignment between cells. This includes all the codepoints at
66
+ *    U+2500 - U+259F except dashes, diagonals and shades.
67
+ * 0: disable (render all glyphs normally from the font).
68
+ */
69
+const int boxdraw = 1;
70
+
71
+/*
72
+ * bell volume. It must be a value between -100 and 100. Use 0 for disabling
73
+ * it
74
+ */
75
+static int bellvolume = 0;
76
+
77
+/* default TERM value */
78
+char *termname = "st-256color";
79
+
80
+/*
81
+ * spaces per tab
82
+ *
83
+ * When you are changing this value, don't forget to adapt the »it« value in
84
+ * the st.info and appropriately install the st.info in the environment where
85
+ * you use this st version.
86
+ *
87
+ *	it#$tabspaces,
88
+ *
89
+ * Secondly make sure your kernel is not expanding tabs. When running `stty
90
+ * -a` »tab0« should appear. You can tell the terminal to not expand tabs by
91
+ *  running following command:
92
+ *
93
+ *	stty tabs
94
+ */
95
+unsigned int tabspaces = 8;
96
+
97
+/* Terminal colors (16 first used in escape sequence) */
98
+static const char *colorname[] = {
99
+	/* 8 normal colors */
100
+	"#073642",  /*  0: black    */
101
+	"#dc322f",  /*  1: red      */
102
+	"#859900",  /*  2: green    */
103
+	"#b58900",  /*  3: yellow   */
104
+	"#268bd2",  /*  4: blue     */
105
+	"#d33682",  /*  5: magenta  */
106
+	"#2aa198",  /*  6: cyan     */
107
+	"#eee8d5",  /*  7: white    */
108
+
109
+	/* 8 bright colors */
110
+	"#002b36",  /*  8: brblack  */
111
+	"#cb4b16",  /*  9: brred    */
112
+	"#586e75",  /* 10: brgreen  */
113
+	"#657b83",  /* 11: bryellow */
114
+	"#839496",  /* 12: brblue   */
115
+	"#6c71c4",  /* 13: brmagenta*/
116
+	"#93a1a1",  /* 14: brcyan   */
117
+	"#fdf6e3",  /* 15: brwhite  */
118
+
119
+	[255] = 0,
120
+};
121
+
122
+
123
+/*
124
+ * Default colors (colorname index)
125
+ * foreground, default color for bold text, background, cursor, reverse cursor
126
+ */
127
+/* solarized dark */
128
+/*
129
+unsigned int defaultfg = 12;
130
+unsigned int defaultbd = 15;
131
+unsigned int defaultbg = 8;
132
+ */
133
+
134
+/* solarized light */
135
+unsigned int defaultfg = 11;
136
+unsigned int defaultbd = 0;
137
+unsigned int defaultbg = 15;
138
+
139
+static unsigned int defaultcs = 9;
140
+static unsigned int defaultrcs = 11;
141
+
142
+/*
143
+ * Default shape of cursor
144
+ * 2: Block ("█")
145
+ * 4: Underline ("_")
146
+ * 6: Bar ("|")
147
+ * 7: Snowman ("☃")
148
+ */
149
+static unsigned int cursorshape = 2;
150
+
151
+/*
152
+ * Default columns and rows numbers
153
+ */
154
+
155
+static unsigned int cols = 80;
156
+static unsigned int rows = 24;
157
+
158
+/*
159
+ * Default colour and shape of the mouse cursor
160
+ */
161
+static unsigned int mouseshape = XC_arrow;
162
+static unsigned int mousefg = 7;
163
+static unsigned int mousebg = 0;
164
+
165
+/*
166
+ * Color used to display font attributes when fontconfig selected a font which
167
+ * doesn't match the ones requested.
168
+ */
169
+static unsigned int defaultattr = 11;
170
+
171
+/*
172
+ * Internal mouse shortcuts.
173
+ * Beware that overloading Button1 will disable the selection.
174
+ */
175
+static MouseShortcut mshortcuts[] = {
176
+	/* button               mask            string */
177
+	{ Button4,              XK_ANY_MOD,     "\031" },
178
+	{ Button5,              XK_ANY_MOD,     "\005" },
179
+};
180
+
181
+/* Internal keyboard shortcuts. */
182
+#define MODKEY Mod1Mask
183
+#define TERMMOD (ControlMask|ShiftMask)
184
+
185
+static Shortcut shortcuts[] = {
186
+	/* mask                 keysym          function        argument */
187
+	{ XK_ANY_MOD,           XK_Break,       sendbreak,      {.i =  0} },
188
+	{ ControlMask,          XK_Print,       toggleprinter,  {.i =  0} },
189
+	{ ShiftMask,            XK_Print,       printscreen,    {.i =  0} },
190
+	{ XK_ANY_MOD,           XK_Print,       printsel,       {.i =  0} },
191
+	{ TERMMOD,              XK_Prior,       zoom,           {.f = +1} },
192
+	{ TERMMOD,              XK_Next,        zoom,           {.f = -1} },
193
+	{ TERMMOD,              XK_Home,        zoomreset,      {.f =  0} },
194
+	{ TERMMOD,              XK_C,           clipcopy,       {.i =  0} },
195
+	{ TERMMOD,              XK_V,           clippaste,      {.i =  0} },
196
+	{ TERMMOD,              XK_Y,           selpaste,       {.i =  0} },
197
+	{ ShiftMask,            XK_Insert,      selpaste,       {.i =  0} },
198
+	{ TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} },
199
+};
200
+
201
+/*
202
+ * Special keys (change & recompile st.info accordingly)
203
+ *
204
+ * Mask value:
205
+ * * Use XK_ANY_MOD to match the key no matter modifiers state
206
+ * * Use XK_NO_MOD to match the key alone (no modifiers)
207
+ * appkey value:
208
+ * * 0: no value
209
+ * * > 0: keypad application mode enabled
210
+ * *   = 2: term.numlock = 1
211
+ * * < 0: keypad application mode disabled
212
+ * appcursor value:
213
+ * * 0: no value
214
+ * * > 0: cursor application mode enabled
215
+ * * < 0: cursor application mode disabled
216
+ * crlf value
217
+ * * 0: no value
218
+ * * > 0: crlf mode is enabled
219
+ * * < 0: crlf mode is disabled
220
+ *
221
+ * Be careful with the order of the definitions because st searches in
222
+ * this table sequentially, so any XK_ANY_MOD must be in the last
223
+ * position for a key.
224
+ */
225
+
226
+/*
227
+ * If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
228
+ * to be mapped below, add them to this array.
229
+ */
230
+static KeySym mappedkeys[] = { -1 };
231
+
232
+/*
233
+ * State bits to ignore when matching key or button events.  By default,
234
+ * numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
235
+ */
236
+static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
237
+
238
+/*
239
+ * Override mouse-select while mask is active (when MODE_MOUSE is set).
240
+ * Note that if you want to use ShiftMask with selmasks, set this to an other
241
+ * modifier, set to 0 to not use it.
242
+ */
243
+static uint forceselmod = ShiftMask;
244
+
245
+/*
246
+ * This is the huge key array which defines all compatibility to the Linux
247
+ * world. Please decide about changes wisely.
248
+ */
249
+static Key key[] = {
250
+	/* keysym           mask            string      appkey appcursor */
251
+	{ XK_KP_Home,       ShiftMask,      "\033[2J",       0,   -1},
252
+	{ XK_KP_Home,       ShiftMask,      "\033[1;2H",     0,   +1},
253
+	{ XK_KP_Home,       XK_ANY_MOD,     "\033[H",        0,   -1},
254
+	{ XK_KP_Home,       XK_ANY_MOD,     "\033[1~",       0,   +1},
255
+	{ XK_KP_Up,         XK_ANY_MOD,     "\033Ox",       +1,    0},
256
+	{ XK_KP_Up,         XK_ANY_MOD,     "\033[A",        0,   -1},
257
+	{ XK_KP_Up,         XK_ANY_MOD,     "\033OA",        0,   +1},
258
+	{ XK_KP_Down,       XK_ANY_MOD,     "\033Or",       +1,    0},
259
+	{ XK_KP_Down,       XK_ANY_MOD,     "\033[B",        0,   -1},
260
+	{ XK_KP_Down,       XK_ANY_MOD,     "\033OB",        0,   +1},
261
+	{ XK_KP_Left,       XK_ANY_MOD,     "\033Ot",       +1,    0},
262
+	{ XK_KP_Left,       XK_ANY_MOD,     "\033[D",        0,   -1},
263
+	{ XK_KP_Left,       XK_ANY_MOD,     "\033OD",        0,   +1},
264
+	{ XK_KP_Right,      XK_ANY_MOD,     "\033Ov",       +1,    0},
265
+	{ XK_KP_Right,      XK_ANY_MOD,     "\033[C",        0,   -1},
266
+	{ XK_KP_Right,      XK_ANY_MOD,     "\033OC",        0,   +1},
267
+	{ XK_KP_Prior,      ShiftMask,      "\033[5;2~",     0,    0},
268
+	{ XK_KP_Prior,      XK_ANY_MOD,     "\033[5~",       0,    0},
269
+	{ XK_KP_Begin,      XK_ANY_MOD,     "\033[E",        0,    0},
270
+	{ XK_KP_End,        ControlMask,    "\033[J",       -1,    0},
271
+	{ XK_KP_End,        ControlMask,    "\033[1;5F",    +1,    0},
272
+	{ XK_KP_End,        ShiftMask,      "\033[K",       -1,    0},
273
+	{ XK_KP_End,        ShiftMask,      "\033[1;2F",    +1,    0},
274
+	{ XK_KP_End,        XK_ANY_MOD,     "\033[4~",       0,    0},
275
+	{ XK_KP_Next,       ShiftMask,      "\033[6;2~",     0,    0},
276
+	{ XK_KP_Next,       XK_ANY_MOD,     "\033[6~",       0,    0},
277
+	{ XK_KP_Insert,     ShiftMask,      "\033[2;2~",    +1,    0},
278
+	{ XK_KP_Insert,     ShiftMask,      "\033[4l",      -1,    0},
279
+	{ XK_KP_Insert,     ControlMask,    "\033[L",       -1,    0},
280
+	{ XK_KP_Insert,     ControlMask,    "\033[2;5~",    +1,    0},
281
+	{ XK_KP_Insert,     XK_ANY_MOD,     "\033[4h",      -1,    0},
282
+	{ XK_KP_Insert,     XK_ANY_MOD,     "\033[2~",      +1,    0},
283
+	{ XK_KP_Delete,     ControlMask,    "\033[M",       -1,    0},
284
+	{ XK_KP_Delete,     ControlMask,    "\033[3;5~",    +1,    0},
285
+	{ XK_KP_Delete,     ShiftMask,      "\033[2K",      -1,    0},
286
+	{ XK_KP_Delete,     ShiftMask,      "\033[3;2~",    +1,    0},
287
+	{ XK_KP_Delete,     XK_ANY_MOD,     "\033[P",       -1,    0},
288
+	{ XK_KP_Delete,     XK_ANY_MOD,     "\033[3~",      +1,    0},
289
+	{ XK_KP_Multiply,   XK_ANY_MOD,     "\033Oj",       +2,    0},
290
+	{ XK_KP_Add,        XK_ANY_MOD,     "\033Ok",       +2,    0},
291
+	{ XK_KP_Enter,      XK_ANY_MOD,     "\033OM",       +2,    0},
292
+	{ XK_KP_Enter,      XK_ANY_MOD,     "\r",           -1,    0},
293
+	{ XK_KP_Subtract,   XK_ANY_MOD,     "\033Om",       +2,    0},
294
+	{ XK_KP_Decimal,    XK_ANY_MOD,     "\033On",       +2,    0},
295
+	{ XK_KP_Divide,     XK_ANY_MOD,     "\033Oo",       +2,    0},
296
+	{ XK_KP_0,          XK_ANY_MOD,     "\033Op",       +2,    0},
297
+	{ XK_KP_1,          XK_ANY_MOD,     "\033Oq",       +2,    0},
298
+	{ XK_KP_2,          XK_ANY_MOD,     "\033Or",       +2,    0},
299
+	{ XK_KP_3,          XK_ANY_MOD,     "\033Os",       +2,    0},
300
+	{ XK_KP_4,          XK_ANY_MOD,     "\033Ot",       +2,    0},
301
+	{ XK_KP_5,          XK_ANY_MOD,     "\033Ou",       +2,    0},
302
+	{ XK_KP_6,          XK_ANY_MOD,     "\033Ov",       +2,    0},
303
+	{ XK_KP_7,          XK_ANY_MOD,     "\033Ow",       +2,    0},
304
+	{ XK_KP_8,          XK_ANY_MOD,     "\033Ox",       +2,    0},
305
+	{ XK_KP_9,          XK_ANY_MOD,     "\033Oy",       +2,    0},
306
+	{ XK_Up,            ShiftMask,      "\033[1;2A",     0,    0},
307
+	{ XK_Up,            Mod1Mask,       "\033[1;3A",     0,    0},
308
+	{ XK_Up,         ShiftMask|Mod1Mask,"\033[1;4A",     0,    0},
309
+	{ XK_Up,            ControlMask,    "\033[1;5A",     0,    0},
310
+	{ XK_Up,      ShiftMask|ControlMask,"\033[1;6A",     0,    0},
311
+	{ XK_Up,       ControlMask|Mod1Mask,"\033[1;7A",     0,    0},
312
+	{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A",  0,    0},
313
+	{ XK_Up,            XK_ANY_MOD,     "\033[A",        0,   -1},
314
+	{ XK_Up,            XK_ANY_MOD,     "\033OA",        0,   +1},
315
+	{ XK_Down,          ShiftMask,      "\033[1;2B",     0,    0},
316
+	{ XK_Down,          Mod1Mask,       "\033[1;3B",     0,    0},
317
+	{ XK_Down,       ShiftMask|Mod1Mask,"\033[1;4B",     0,    0},
318
+	{ XK_Down,          ControlMask,    "\033[1;5B",     0,    0},
319
+	{ XK_Down,    ShiftMask|ControlMask,"\033[1;6B",     0,    0},
320
+	{ XK_Down,     ControlMask|Mod1Mask,"\033[1;7B",     0,    0},
321
+	{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0,    0},
322
+	{ XK_Down,          XK_ANY_MOD,     "\033[B",        0,   -1},
323
+	{ XK_Down,          XK_ANY_MOD,     "\033OB",        0,   +1},
324
+	{ XK_Left,          ShiftMask,      "\033[1;2D",     0,    0},
325
+	{ XK_Left,          Mod1Mask,       "\033[1;3D",     0,    0},
326
+	{ XK_Left,       ShiftMask|Mod1Mask,"\033[1;4D",     0,    0},
327
+	{ XK_Left,          ControlMask,    "\033[1;5D",     0,    0},
328
+	{ XK_Left,    ShiftMask|ControlMask,"\033[1;6D",     0,    0},
329
+	{ XK_Left,     ControlMask|Mod1Mask,"\033[1;7D",     0,    0},
330
+	{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0,    0},
331
+	{ XK_Left,          XK_ANY_MOD,     "\033[D",        0,   -1},
332
+	{ XK_Left,          XK_ANY_MOD,     "\033OD",        0,   +1},
333
+	{ XK_Right,         ShiftMask,      "\033[1;2C",     0,    0},
334
+	{ XK_Right,         Mod1Mask,       "\033[1;3C",     0,    0},
335
+	{ XK_Right,      ShiftMask|Mod1Mask,"\033[1;4C",     0,    0},
336
+	{ XK_Right,         ControlMask,    "\033[1;5C",     0,    0},
337
+	{ XK_Right,   ShiftMask|ControlMask,"\033[1;6C",     0,    0},
338
+	{ XK_Right,    ControlMask|Mod1Mask,"\033[1;7C",     0,    0},
339
+	{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0,   0},
340
+	{ XK_Right,         XK_ANY_MOD,     "\033[C",        0,   -1},
341
+	{ XK_Right,         XK_ANY_MOD,     "\033OC",        0,   +1},
342
+	{ XK_ISO_Left_Tab,  ShiftMask,      "\033[Z",        0,    0},
343
+	{ XK_Return,        Mod1Mask,       "\033\r",        0,    0},
344
+	{ XK_Return,        XK_ANY_MOD,     "\r",            0,    0},
345
+	{ XK_Insert,        ShiftMask,      "\033[4l",      -1,    0},
346
+	{ XK_Insert,        ShiftMask,      "\033[2;2~",    +1,    0},
347
+	{ XK_Insert,        ControlMask,    "\033[L",       -1,    0},
348
+	{ XK_Insert,        ControlMask,    "\033[2;5~",    +1,    0},
349
+	{ XK_Insert,        XK_ANY_MOD,     "\033[4h",      -1,    0},
350
+	{ XK_Insert,        XK_ANY_MOD,     "\033[2~",      +1,    0},
351
+	{ XK_Delete,        ControlMask,    "\033[M",       -1,    0},
352
+	{ XK_Delete,        ControlMask,    "\033[3;5~",    +1,    0},
353
+	{ XK_Delete,        ShiftMask,      "\033[2K",      -1,    0},
354
+	{ XK_Delete,        ShiftMask,      "\033[3;2~",    +1,    0},
355
+	{ XK_Delete,        XK_ANY_MOD,     "\033[P",       -1,    0},
356
+	{ XK_Delete,        XK_ANY_MOD,     "\033[3~",      +1,    0},
357
+	{ XK_BackSpace,     XK_NO_MOD,      "\177",          0,    0},
358
+	{ XK_BackSpace,     Mod1Mask,       "\033\177",      0,    0},
359
+	{ XK_Home,          ShiftMask,      "\033[2J",       0,   -1},
360
+	{ XK_Home,          ShiftMask,      "\033[1;2H",     0,   +1},
361
+	{ XK_Home,          XK_ANY_MOD,     "\033[H",        0,   -1},
362
+	{ XK_Home,          XK_ANY_MOD,     "\033[1~",       0,   +1},
363
+	{ XK_End,           ControlMask,    "\033[J",       -1,    0},
364
+	{ XK_End,           ControlMask,    "\033[1;5F",    +1,    0},
365
+	{ XK_End,           ShiftMask,      "\033[K",       -1,    0},
366
+	{ XK_End,           ShiftMask,      "\033[1;2F",    +1,    0},
367
+	{ XK_End,           XK_ANY_MOD,     "\033[4~",       0,    0},
368
+	{ XK_Prior,         ControlMask,    "\033[5;5~",     0,    0},
369
+	{ XK_Prior,         ShiftMask,      "\033[5;2~",     0,    0},
370
+	{ XK_Prior,         XK_ANY_MOD,     "\033[5~",       0,    0},
371
+	{ XK_Next,          ControlMask,    "\033[6;5~",     0,    0},
372
+	{ XK_Next,          ShiftMask,      "\033[6;2~",     0,    0},
373
+	{ XK_Next,          XK_ANY_MOD,     "\033[6~",       0,    0},
374
+	{ XK_F1,            XK_NO_MOD,      "\033OP" ,       0,    0},
375
+	{ XK_F1, /* F13 */  ShiftMask,      "\033[1;2P",     0,    0},
376
+	{ XK_F1, /* F25 */  ControlMask,    "\033[1;5P",     0,    0},
377
+	{ XK_F1, /* F37 */  Mod4Mask,       "\033[1;6P",     0,    0},
378
+	{ XK_F1, /* F49 */  Mod1Mask,       "\033[1;3P",     0,    0},
379
+	{ XK_F1, /* F61 */  Mod3Mask,       "\033[1;4P",     0,    0},
380
+	{ XK_F2,            XK_NO_MOD,      "\033OQ" ,       0,    0},
381
+	{ XK_F2, /* F14 */  ShiftMask,      "\033[1;2Q",     0,    0},
382
+	{ XK_F2, /* F26 */  ControlMask,    "\033[1;5Q",     0,    0},
383
+	{ XK_F2, /* F38 */  Mod4Mask,       "\033[1;6Q",     0,    0},
384
+	{ XK_F2, /* F50 */  Mod1Mask,       "\033[1;3Q",     0,    0},
385
+	{ XK_F2, /* F62 */  Mod3Mask,       "\033[1;4Q",     0,    0},
386
+	{ XK_F3,            XK_NO_MOD,      "\033OR" ,       0,    0},
387
+	{ XK_F3, /* F15 */  ShiftMask,      "\033[1;2R",     0,    0},
388
+	{ XK_F3, /* F27 */  ControlMask,    "\033[1;5R",     0,    0},
389
+	{ XK_F3, /* F39 */  Mod4Mask,       "\033[1;6R",     0,    0},
390
+	{ XK_F3, /* F51 */  Mod1Mask,       "\033[1;3R",     0,    0},
391
+	{ XK_F3, /* F63 */  Mod3Mask,       "\033[1;4R",     0,    0},
392
+	{ XK_F4,            XK_NO_MOD,      "\033OS" ,       0,    0},
393
+	{ XK_F4, /* F16 */  ShiftMask,      "\033[1;2S",     0,    0},
394
+	{ XK_F4, /* F28 */  ControlMask,    "\033[1;5S",     0,    0},
395
+	{ XK_F4, /* F40 */  Mod4Mask,       "\033[1;6S",     0,    0},
396
+	{ XK_F4, /* F52 */  Mod1Mask,       "\033[1;3S",     0,    0},
397
+	{ XK_F5,            XK_NO_MOD,      "\033[15~",      0,    0},
398
+	{ XK_F5, /* F17 */  ShiftMask,      "\033[15;2~",    0,    0},
399
+	{ XK_F5, /* F29 */  ControlMask,    "\033[15;5~",    0,    0},
400
+	{ XK_F5, /* F41 */  Mod4Mask,       "\033[15;6~",    0,    0},
401
+	{ XK_F5, /* F53 */  Mod1Mask,       "\033[15;3~",    0,    0},
402
+	{ XK_F6,            XK_NO_MOD,      "\033[17~",      0,    0},
403
+	{ XK_F6, /* F18 */  ShiftMask,      "\033[17;2~",    0,    0},
404
+	{ XK_F6, /* F30 */  ControlMask,    "\033[17;5~",    0,    0},
405
+	{ XK_F6, /* F42 */  Mod4Mask,       "\033[17;6~",    0,    0},
406
+	{ XK_F6, /* F54 */  Mod1Mask,       "\033[17;3~",    0,    0},
407
+	{ XK_F7,            XK_NO_MOD,      "\033[18~",      0,    0},
408
+	{ XK_F7, /* F19 */  ShiftMask,      "\033[18;2~",    0,    0},
409
+	{ XK_F7, /* F31 */  ControlMask,    "\033[18;5~",    0,    0},
410
+	{ XK_F7, /* F43 */  Mod4Mask,       "\033[18;6~",    0,    0},
411
+	{ XK_F7, /* F55 */  Mod1Mask,       "\033[18;3~",    0,    0},
412
+	{ XK_F8,            XK_NO_MOD,      "\033[19~",      0,    0},
413
+	{ XK_F8, /* F20 */  ShiftMask,      "\033[19;2~",    0,    0},
414
+	{ XK_F8, /* F32 */  ControlMask,    "\033[19;5~",    0,    0},
415
+	{ XK_F8, /* F44 */  Mod4Mask,       "\033[19;6~",    0,    0},
416
+	{ XK_F8, /* F56 */  Mod1Mask,       "\033[19;3~",    0,    0},
417
+	{ XK_F9,            XK_NO_MOD,      "\033[20~",      0,    0},
418
+	{ XK_F9, /* F21 */  ShiftMask,      "\033[20;2~",    0,    0},
419
+	{ XK_F9, /* F33 */  ControlMask,    "\033[20;5~",    0,    0},
420
+	{ XK_F9, /* F45 */  Mod4Mask,       "\033[20;6~",    0,    0},
421
+	{ XK_F9, /* F57 */  Mod1Mask,       "\033[20;3~",    0,    0},
422
+	{ XK_F10,           XK_NO_MOD,      "\033[21~",      0,    0},
423
+	{ XK_F10, /* F22 */ ShiftMask,      "\033[21;2~",    0,    0},
424
+	{ XK_F10, /* F34 */ ControlMask,    "\033[21;5~",    0,    0},
425
+	{ XK_F10, /* F46 */ Mod4Mask,       "\033[21;6~",    0,    0},
426
+	{ XK_F10, /* F58 */ Mod1Mask,       "\033[21;3~",    0,    0},
427
+	{ XK_F11,           XK_NO_MOD,      "\033[23~",      0,    0},
428
+	{ XK_F11, /* F23 */ ShiftMask,      "\033[23;2~",    0,    0},
429
+	{ XK_F11, /* F35 */ ControlMask,    "\033[23;5~",    0,    0},
430
+	{ XK_F11, /* F47 */ Mod4Mask,       "\033[23;6~",    0,    0},
431
+	{ XK_F11, /* F59 */ Mod1Mask,       "\033[23;3~",    0,    0},
432
+	{ XK_F12,           XK_NO_MOD,      "\033[24~",      0,    0},
433
+	{ XK_F12, /* F24 */ ShiftMask,      "\033[24;2~",    0,    0},
434
+	{ XK_F12, /* F36 */ ControlMask,    "\033[24;5~",    0,    0},
435
+	{ XK_F12, /* F48 */ Mod4Mask,       "\033[24;6~",    0,    0},
436
+	{ XK_F12, /* F60 */ Mod1Mask,       "\033[24;3~",    0,    0},
437
+	{ XK_F13,           XK_NO_MOD,      "\033[1;2P",     0,    0},
438
+	{ XK_F14,           XK_NO_MOD,      "\033[1;2Q",     0,    0},
439
+	{ XK_F15,           XK_NO_MOD,      "\033[1;2R",     0,    0},
440
+	{ XK_F16,           XK_NO_MOD,      "\033[1;2S",     0,    0},
441
+	{ XK_F17,           XK_NO_MOD,      "\033[15;2~",    0,    0},
442
+	{ XK_F18,           XK_NO_MOD,      "\033[17;2~",    0,    0},
443
+	{ XK_F19,           XK_NO_MOD,      "\033[18;2~",    0,    0},
444
+	{ XK_F20,           XK_NO_MOD,      "\033[19;2~",    0,    0},
445
+	{ XK_F21,           XK_NO_MOD,      "\033[20;2~",    0,    0},
446
+	{ XK_F22,           XK_NO_MOD,      "\033[21;2~",    0,    0},
447
+	{ XK_F23,           XK_NO_MOD,      "\033[23;2~",    0,    0},
448
+	{ XK_F24,           XK_NO_MOD,      "\033[24;2~",    0,    0},
449
+	{ XK_F25,           XK_NO_MOD,      "\033[1;5P",     0,    0},
450
+	{ XK_F26,           XK_NO_MOD,      "\033[1;5Q",     0,    0},
451
+	{ XK_F27,           XK_NO_MOD,      "\033[1;5R",     0,    0},
452
+	{ XK_F28,           XK_NO_MOD,      "\033[1;5S",     0,    0},
453
+	{ XK_F29,           XK_NO_MOD,      "\033[15;5~",    0,    0},
454
+	{ XK_F30,           XK_NO_MOD,      "\033[17;5~",    0,    0},
455
+	{ XK_F31,           XK_NO_MOD,      "\033[18;5~",    0,    0},
456
+	{ XK_F32,           XK_NO_MOD,      "\033[19;5~",    0,    0},
457
+	{ XK_F33,           XK_NO_MOD,      "\033[20;5~",    0,    0},
458
+	{ XK_F34,           XK_NO_MOD,      "\033[21;5~",    0,    0},
459
+	{ XK_F35,           XK_NO_MOD,      "\033[23;5~",    0,    0},
460
+};
461
+
462
+/*
463
+ * Selection types' masks.
464
+ * Use the same masks as usual.
465
+ * Button1Mask is always unset, to make masks match between ButtonPress.
466
+ * ButtonRelease and MotionNotify.
467
+ * If no match is found, regular selection is used.
468
+ */
469
+static uint selmasks[] = {
470
+	[SEL_RECTANGULAR] = Mod1Mask,
471
+};
472
+
473
+/*
474
+ * Printable characters in ASCII, used to estimate the advance width
475
+ * of single wide characters.
476
+ */
477
+static char ascii_printable[] =
478
+	" !\"#$%&'()*+,-./0123456789:;<=>?"
479
+	"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
480
+	"`abcdefghijklmnopqrstuvwxyz{|}~";

+ 30
- 0
makest.sh View File

@@ -0,0 +1,30 @@
1
+#!/usr/bin/env zsh
2
+ST_REPO=https://git.suckless.org/st
3
+ST_SRC=$PWD/st
4
+ST_CFG=$PWD/config.h
5
+PATCHLIST=(
6
+    st-boxdraw.patch
7
+    st-bright-bold-text.patch
8
+    st-config-mk.patch
9
+    st-disable-bold-italic-fonts.patch
10
+    st-disable-intensity-styles.patch
11
+    st-fix-argv.patch
12
+)
13
+
14
+if [[ ! -r $ST_SRC/.git/config ]]; then
15
+    git clone $ST_REPO $ST_SRC
16
+    cd $ST_SRC
17
+else
18
+    cd $ST_SRC
19
+    git reset --hard
20
+    git clean -fd
21
+    git pull
22
+fi
23
+
24
+cp $ST_CFG .
25
+
26
+for patch in $PATCHLIST; do
27
+    patch -p1 -i ../$patch
28
+done
29
+
30
+make $*

+ 517
- 0
st-boxdraw.patch View File

@@ -0,0 +1,517 @@
1
+From 1630b7016d26c266d004f38ecfef2c4b708aa9a6 Mon Sep 17 00:00:00 2001
2
+From: "Avi Halachmi (:avih)" <avihpit@yahoo.com>
3
+Date: Fri, 26 Oct 2018 13:11:20 +0300
4
+Subject: [PATCH] boxdraw: custom-draw U+25XX lines/blocks to align seamlessly
5
+
6
+It seems impossible to ensure that blocks and line drawing glyphs
7
+align without visible gaps for all combinations of arbitrary font,
8
+size and width/height scale factor.
9
+
10
+This commit adds an option to custom-draw (without using the font)
11
+most of the lines/blocks codepoints such that they're rendered
12
+identically (per size) and align perfectly regardless of font, size
13
+or chscale/cwscale configuration values.
14
+
15
+138 shapes are supported (U+2500 - U+259F except dashes, diagonals
16
+and shades), composited as 16-bit values at boxdraw_data.h .
17
+
18
+See links and references at boxdraw_data.h
19
+---
20
+ Makefile       |   3 +-
21
+ boxdraw.c      | 141 ++++++++++++++++++++++++++++++++++
22
+ boxdraw_data.h | 202 +++++++++++++++++++++++++++++++++++++++++++++++++
23
+ config.def.h   |   8 ++
24
+ st.c           |   3 +
25
+ st.h           |   9 +++
26
+ x.c            |  19 +++--
27
+ 7 files changed, 379 insertions(+), 6 deletions(-)
28
+ create mode 100644 boxdraw.c
29
+ create mode 100644 boxdraw_data.h
30
+
31
+diff --git a/Makefile b/Makefile
32
+index 0b3cecd..8d3af33 100644
33
+--- a/Makefile
34
++++ b/Makefile
35
+@@ -4,7 +4,7 @@
36
+ 
37
+ include config.mk
38
+ 
39
+-SRC = st.c x.c
40
++SRC = st.c x.c boxdraw.c
41
+ OBJ = $(SRC:.c=.o)
42
+ 
43
+ all: options st
44
+@@ -23,6 +23,7 @@ config.h:
45
+ 
46
+ st.o: config.h st.h win.h
47
+ x.o: arg.h st.h win.h
48
++boxdraw.o: config.h st.h boxdraw_data.h
49
+ 
50
+ $(OBJ): config.h config.mk
51
+ 
52
+diff --git a/boxdraw.c b/boxdraw.c
53
+new file mode 100644
54
+index 0000000..357250f
55
+--- /dev/null
56
++++ b/boxdraw.c
57
+@@ -0,0 +1,141 @@
58
++#include <X11/Xft/Xft.h>
59
++#include "st.h"
60
++#include "boxdraw_data.h"
61
++
62
++static void drawbox(XftDraw *, int, int, int, int, XftColor *, ushort);
63
++static void drawboxlines(XftDraw *, int, int, int, int, XftColor *, ushort);
64
++
65
++/* public API */
66
++
67
++int
68
++isboxdraw(const Glyph *g)
69
++{
70
++	return (g->u & ~0xff) == 0x2500 &&
71
++	       boxdata[(uint8_t)g->u] != 0 &&
72
++	       (g->mode & ATTR_ITALIC) == 0;
73
++}
74
++
75
++/* the "index" is actually the entire shape data encoded as ushort */
76
++ushort
77
++boxdrawindex(const Glyph *g)
78
++{
79
++	return boxdata[(uint8_t)g->u] | ((g->mode & ATTR_BOLD) ? BDB : 0);
80
++}
81
++
82
++void
83
++drawboxes(XftDraw *xd, int x, int y, int cw, int ch, XftColor *fg,
84
++          const XftGlyphFontSpec *specs, int len)
85
++{
86
++	for ( ; len-- > 0; x += cw, specs++)
87
++		drawbox(xd, x, y, cw, ch, fg, (ushort)specs->glyph);
88
++}
89
++
90
++/* implementation */
91
++
92
++void
93
++drawbox(XftDraw *xd, int x, int y, int w, int h, XftColor *fg, ushort bd)
94
++{
95
++	if (bd & (BDL | BDA)) {
96
++		/* lines (light/double/heavy/arcs) */
97
++		drawboxlines(xd, x, y, w, h, fg, bd);
98
++
99
++	} else if (bd & BBD) {
100
++		/* lower (8-X)/8 block */
101
++		int d = ((uint8_t)bd * h + 4) / 8;
102
++		XftDrawRect(xd, fg, x, y + d, w, h - d);
103
++
104
++	} else if (bd & BBU) {
105
++		/* upper X/8 block */
106
++		XftDrawRect(xd, fg, x, y, w, ((uint8_t)bd * h + 4) / 8);
107
++
108
++	} else if (bd & BBL) {
109
++		/* left X/8 block */
110
++		XftDrawRect(xd, fg, x, y, ((uint8_t)bd * w + 4) / 8, h);
111
++
112
++	} else if (bd & BBR) {
113
++		/* right (8-X)/8 block */
114
++		int d = ((uint8_t)bd * w + 4) / 8;
115
++		XftDrawRect(xd, fg, x + d, y, w - d, h);
116
++
117
++	} else if (bd & BBQ) {
118
++		/* Quadrants */
119
++		int w2 = (w + 1) / 2, h2 = (h + 1) / 2;
120
++		if (bd & TL)
121
++			XftDrawRect(xd, fg, x, y, w2, h2);
122
++		if (bd & TR)
123
++			XftDrawRect(xd, fg, x + w2, y, w - w2, h2);
124
++		if (bd & BL)
125
++			XftDrawRect(xd, fg, x, y + h2, w2, h - h2);
126
++		if (bd & BR)
127
++			XftDrawRect(xd, fg, x + w2, y + h2, w - w2, h - h2);
128
++	}
129
++}
130
++
131
++void
132
++drawboxlines(XftDraw *xd, int x, int y, int w, int h, XftColor *fg, ushort bd)
133
++{
134
++	/* s: stem thickness. width/8 roughly matches underscore thickness. */
135
++	/* We draw bold as 1.5 * normal-stem and at least 1px thicker.      */
136
++	/* doubles draw at least 3px, even when w or h < 3. bold needs 6px. */
137
++	int mwh = MIN(w, h);
138
++	int base_s = MAX(1, (mwh + 4) / 8);
139
++	int bold = (bd & BDB) && mwh >= 6;  /* possibly ignore boldness */
140
++	int s = bold ? MAX(base_s + 1, (3 * base_s + 1) / 2) : base_s;
141
++	int w2 = (w - s + 1) / 2, h2 = (h - s + 1) / 2;
142
++	/* the s-by-s square (x + w2, y + h2, s, s) is the center texel.    */
143
++	/* The base length (per direction till edge) includes this square.  */
144
++
145
++	int light = bd & (LL | LU | LR | LD);
146
++	int double_ = bd & (DL | DU | DR | DD);
147
++
148
++	if (light) {
149
++		/* d: additional (negative) length to not-draw the center   */
150
++		/* texel - at arcs and avoid drawing inside (some) doubles  */
151
++		int arc = bd & BDA;
152
++		int multi_light = light & (light - 1);
153
++		int multi_double = double_ & (double_ - 1);
154
++		/* light crosses double only at DH+LV, DV+LH (ref. shapes)  */
155
++		int d = arc || (multi_double && !multi_light) ? -s : 0;
156
++
157
++		if (bd & LL)
158
++			XftDrawRect(xd, fg, x, y + h2, w2 + s + d, s);
159
++		if (bd & LU)
160
++			XftDrawRect(xd, fg, x + w2, y, s, h2 + s + d);
161
++		if (bd & LR)
162
++			XftDrawRect(xd, fg, x + w2 - d, y + h2, w - w2 + d, s);
163
++		if (bd & LD)
164
++			XftDrawRect(xd, fg, x + w2, y + h2 - d, s, h - h2 + d);
165
++	}
166
++
167
++	/* double lines - also align with light to form heavy when combined */
168
++	if (double_) {
169
++		/*
170
++		* going clockwise, for each double-ray: p is additional length
171
++		* to the single-ray nearer to the previous direction, and n to
172
++		* the next. p and n adjust from the base length to lengths
173
++		* which consider other doubles - shorter to avoid intersections
174
++		* (p, n), or longer to draw the far-corner texel (n).
175
++		*/
176
++		int dl = bd & DL, du = bd & DU, dr = bd & DR, dd = bd & DD;
177
++		if (dl) {
178
++			int p = dd ? -s : 0, n = du ? -s : dd ? s : 0;
179
++			XftDrawRect(xd, fg, x, y + h2 + s, w2 + s + p, s);
180
++			XftDrawRect(xd, fg, x, y + h2 - s, w2 + s + n, s);
181
++		}
182
++		if (du) {
183
++			int p = dl ? -s : 0, n = dr ? -s : dl ? s : 0;
184
++			XftDrawRect(xd, fg, x + w2 - s, y, s, h2 + s + p);
185
++			XftDrawRect(xd, fg, x + w2 + s, y, s, h2 + s + n);
186
++		}
187
++		if (dr) {
188
++			int p = du ? -s : 0, n = dd ? -s : du ? s : 0;
189
++			XftDrawRect(xd, fg, x + w2 - p, y + h2 - s, w - w2 + p, s);
190
++			XftDrawRect(xd, fg, x + w2 - n, y + h2 + s, w - w2 + n, s);
191
++		}
192
++		if (dd) {
193
++			int p = dr ? -s : 0, n = dl ? -s : dr ? s : 0;
194
++			XftDrawRect(xd, fg, x + w2 + s, y + h2 - p, s, h - h2 + p);
195
++			XftDrawRect(xd, fg, x + w2 - s, y + h2 - n, s, h - h2 + n);
196
++		}
197
++	}
198
++}
199
+diff --git a/boxdraw_data.h b/boxdraw_data.h
200
+new file mode 100644
201
+index 0000000..ee78cdc
202
+--- /dev/null
203
++++ b/boxdraw_data.h
204
+@@ -0,0 +1,202 @@
205
++/*
206
++ * U+25XX codepoints data
207
++ *
208
++ * References:
209
++ *   http://www.unicode.org/charts/PDF/U2500.pdf
210
++ *   http://www.unicode.org/charts/PDF/U2580.pdf
211
++ *
212
++ * Test page:
213
++ *   https://github.com/GNOME/vte/blob/master/doc/boxes.txt
214
++ */
215
++
216
++/* Each shape is encoded as 16-bits. Higher bits are category, lower are data */
217
++/* Categories (mutually exclusive except BDB): */
218
++#define BDL (1<<8)   /* Box Draw Lines (light/double/heavy) */
219
++#define BDA (1<<9)   /* Box Draw Arc (light) */
220
++#define BBD (1<<10)  /* Box Block Down (lower) X/8 */
221
++#define BBL (1<<11)  /* Box Block Left X/8 */
222
++#define BBU (1<<12)  /* Box Block Upper X/8 */
223
++#define BBR (1<<13)  /* Box Block Right X/8 */
224
++#define BBQ (1<<14)  /* Box Block Quadrants */
225
++#define BDB (1<<15)  /* Box Draw is Bold */
226
++
227
++/* (BDL/BDA) Light/Double/Heavy x Left/Up/Right/Down/Horizontal/Vertical      */
228
++/* Heavy is light+double (literally drawing light+double align to form heavy) */
229
++#define LL (1<<0)
230
++#define LU (1<<1)
231
++#define LR (1<<2)
232
++#define LD (1<<3)
233
++#define LH (LL+LR)
234
++#define LV (LU+LD)
235
++
236
++#define DL (1<<4)
237
++#define DU (1<<5)
238
++#define DR (1<<6)
239
++#define DD (1<<7)
240
++#define DH (DL+DR)
241
++#define DV (DU+DD)
242
++
243
++#define HL (LL+DL)
244
++#define HU (LU+DU)
245
++#define HR (LR+DR)
246
++#define HD (LD+DD)
247
++#define HH (HL+HR)
248
++#define HV (HU+HD)
249
++
250
++/* (BBQ) Quadrants Top/Bottom x Left/Right */
251
++#define TL (1<<0)
252
++#define TR (1<<1)
253
++#define BL (1<<2)
254
++#define BR (1<<3)
255
++
256
++/* 138 shapes are supported: U+2500 - U+259F except dashes/diagonals/shades */
257
++static const unsigned short boxdata[256] = {
258
++	/* light lines */
259
++	[0x00] = BDL + LH,       /* light horizontal */
260
++	[0x02] = BDL + LV,       /* light vertical */
261
++	[0x0c] = BDL + LD + LR,  /* light down and right */
262
++	[0x10] = BDL + LD + LL,  /* light down and left */
263
++	[0x14] = BDL + LU + LR,  /* light up and right */
264
++	[0x18] = BDL + LU + LL,  /* light up and left */
265
++	[0x1c] = BDL + LV + LR,  /* light vertical and right */
266
++	[0x24] = BDL + LV + LL,  /* light vertical and left */
267
++	[0x2c] = BDL + LH + LD,  /* light horizontal and down */
268
++	[0x34] = BDL + LH + LU,  /* light horizontal and up */
269
++	[0x3c] = BDL + LV + LH,  /* light vertical and horizontal */
270
++	[0x74] = BDL + LL,       /* light left */
271
++	[0x75] = BDL + LU,       /* light up */
272
++	[0x76] = BDL + LR,       /* light right */
273
++	[0x77] = BDL + LD,       /* light down */
274
++
275
++	/* heavy [+light] lines */
276
++	[0x01] = BDL + HH,
277
++	[0x03] = BDL + HV,
278
++	[0x0d] = BDL + HR + LD,
279
++	[0x0e] = BDL + HD + LR,
280
++	[0x0f] = BDL + HD + HR,
281
++	[0x11] = BDL + HL + LD,
282
++	[0x12] = BDL + HD + LL,
283
++	[0x13] = BDL + HD + HL,
284
++	[0x15] = BDL + HR + LU,
285
++	[0x16] = BDL + HU + LR,
286
++	[0x17] = BDL + HU + HR,
287
++	[0x19] = BDL + HL + LU,
288
++	[0x1a] = BDL + HU + LL,
289
++	[0x1b] = BDL + HU + HL,
290
++	[0x1d] = BDL + HR + LV,
291
++	[0x1e] = BDL + HU + LD + LR,
292
++	[0x1f] = BDL + HD + LR + LU,
293
++	[0x20] = BDL + HV + LR,
294
++	[0x21] = BDL + HU + HR + LD,
295
++	[0x22] = BDL + HD + HR + LU,
296
++	[0x23] = BDL + HV + HR,
297
++	[0x25] = BDL + HL + LV,
298
++	[0x26] = BDL + HU + LD + LL,
299
++	[0x27] = BDL + HD + LU + LL,
300
++	[0x28] = BDL + HV + LL,
301
++	[0x29] = BDL + HU + HL + LD,
302
++	[0x2a] = BDL + HD + HL + LU,
303
++	[0x2b] = BDL + HV + HL,
304
++	[0x2d] = BDL + HL + LD + LR,
305
++	[0x2e] = BDL + HR + LL + LD,
306
++	[0x2f] = BDL + HH + LD,
307
++	[0x30] = BDL + HD + LH,
308
++	[0x31] = BDL + HD + HL + LR,
309
++	[0x32] = BDL + HR + HD + LL,
310
++	[0x33] = BDL + HH + HD,
311
++	[0x35] = BDL + HL + LU + LR,
312
++	[0x36] = BDL + HR + LU + LL,
313
++	[0x37] = BDL + HH + LU,
314
++	[0x38] = BDL + HU + LH,
315
++	[0x39] = BDL + HU + HL + LR,
316
++	[0x3a] = BDL + HU + HR + LL,
317
++	[0x3b] = BDL + HH + HU,
318
++	[0x3d] = BDL + HL + LV + LR,
319
++	[0x3e] = BDL + HR + LV + LL,
320
++	[0x3f] = BDL + HH + LV,
321
++	[0x40] = BDL + HU + LH + LD,
322
++	[0x41] = BDL + HD + LH + LU,
323
++	[0x42] = BDL + HV + LH,
324
++	[0x43] = BDL + HU + HL + LD + LR,
325
++	[0x44] = BDL + HU + HR + LD + LL,
326
++	[0x45] = BDL + HD + HL + LU + LR,
327
++	[0x46] = BDL + HD + HR + LU + LL,
328
++	[0x47] = BDL + HH + HU + LD,
329
++	[0x48] = BDL + HH + HD + LU,
330
++	[0x49] = BDL + HV + HL + LR,
331
++	[0x4a] = BDL + HV + HR + LL,
332
++	[0x4b] = BDL + HV + HH,
333
++	[0x78] = BDL + HL,
334
++	[0x79] = BDL + HU,
335
++	[0x7a] = BDL + HR,
336
++	[0x7b] = BDL + HD,
337
++	[0x7c] = BDL + HR + LL,
338
++	[0x7d] = BDL + HD + LU,
339
++	[0x7e] = BDL + HL + LR,
340
++	[0x7f] = BDL + HU + LD,
341
++
342
++	/* double [+light] lines */
343
++	[0x50] = BDL + DH,
344
++	[0x51] = BDL + DV,
345
++	[0x52] = BDL + DR + LD,
346
++	[0x53] = BDL + DD + LR,
347
++	[0x54] = BDL + DR + DD,
348
++	[0x55] = BDL + DL + LD,
349
++	[0x56] = BDL + DD + LL,
350
++	[0x57] = BDL + DL + DD,
351
++	[0x58] = BDL + DR + LU,
352
++	[0x59] = BDL + DU + LR,
353
++	[0x5a] = BDL + DU + DR,
354
++	[0x5b] = BDL + DL + LU,
355
++	[0x5c] = BDL + DU + LL,
356
++	[0x5d] = BDL + DL + DU,
357
++	[0x5e] = BDL + DR + LV,
358
++	[0x5f] = BDL + DV + LR,
359
++	[0x60] = BDL + DV + DR,
360
++	[0x61] = BDL + DL + LV,
361
++	[0x62] = BDL + DV + LL,
362
++	[0x63] = BDL + DV + DL,
363
++	[0x64] = BDL + DH + LD,
364
++	[0x65] = BDL + DD + LH,
365
++	[0x66] = BDL + DD + DH,
366
++	[0x67] = BDL + DH + LU,
367
++	[0x68] = BDL + DU + LH,
368
++	[0x69] = BDL + DH + DU,
369
++	[0x6a] = BDL + DH + LV,
370
++	[0x6b] = BDL + DV + LH,
371
++	[0x6c] = BDL + DH + DV,
372
++
373
++	/* (light) arcs */
374
++	[0x6d] = BDA + LD + LR,
375
++	[0x6e] = BDA + LD + LL,
376
++	[0x6f] = BDA + LU + LL,
377
++	[0x70] = BDA + LU + LR,
378
++
379
++	/* Lower (Down) X/8 block (data is 8 - X) */
380
++	[0x81] = BBD + 7, [0x82] = BBD + 6, [0x83] = BBD + 5, [0x84] = BBD + 4,
381
++	[0x85] = BBD + 3, [0x86] = BBD + 2, [0x87] = BBD + 1, [0x88] = BBD + 0,
382
++
383
++	/* Left X/8 block (data is X) */
384
++	[0x89] = BBL + 7, [0x8a] = BBL + 6, [0x8b] = BBL + 5, [0x8c] = BBL + 4,
385
++	[0x8d] = BBL + 3, [0x8e] = BBL + 2, [0x8f] = BBL + 1,
386
++
387
++	/* upper 1/2 (4/8), 1/8 block (X), right 1/2, 1/8 block (8-X) */
388
++	[0x80] = BBU + 4, [0x94] = BBU + 1,
389
++	[0x90] = BBR + 4, [0x95] = BBR + 7,
390
++
391
++	/* Quadrants */
392
++	[0x96] = BBQ + BL,
393
++	[0x97] = BBQ + BR,
394
++	[0x98] = BBQ + TL,
395
++	[0x99] = BBQ + TL + BL + BR,
396
++	[0x9a] = BBQ + TL + BR,
397
++	[0x9b] = BBQ + TL + TR + BL,
398
++	[0x9c] = BBQ + TL + TR + BR,
399
++	[0x9d] = BBQ + TR,
400
++	[0x9e] = BBQ + BL + TR,
401
++	[0x9f] = BBQ + BL + TR + BR,
402
++
403
++	/* U+2504 - U+250B, U+254C - U+254F: unsupported (dashes) */
404
++	/* U+2571 - U+2573: unsupported (diagonals) */
405
++	/* U+2591 - U+2593: unsupported (shades) */
406
++};
407
+diff --git a/config.def.h b/config.def.h
408
+index 823e79f..018cbe4 100644
409
+--- a/config.def.h
410
++++ b/config.def.h
411
+@@ -56,6 +56,14 @@ static unsigned int blinktimeout = 800;
412
+  */
413
+ static unsigned int cursorthickness = 2;
414
+ 
415
++/*
416
++ * 1: custom-draw (without using the font) most of the lines/blocks characters
417
++ *    for gapless alignment between cells. This includes all the codepoints at
418
++ *    U+2500 - U+259F except dashes, diagonals and shades.
419
++ * 0: disable (render all glyphs normally from the font).
420
++ */
421
++const int boxdraw = 0;
422
++
423
+ /*
424
+  * bell volume. It must be a value between -100 and 100. Use 0 for disabling
425
+  * it
426
+diff --git a/st.c b/st.c
427
+index 46cf2da..7ee136a 100644
428
+--- a/st.c
429
++++ b/st.c
430
+@@ -1228,6 +1228,9 @@ tsetchar(Rune u, Glyph *attr, int x, int y)
431
+ 	term.dirty[y] = 1;
432
+ 	term.line[y][x] = *attr;
433
+ 	term.line[y][x].u = u;
434
++
435
++	if (boxdraw && isboxdraw(&term.line[y][x]))
436
++		term.line[y][x].mode |= ATTR_BOXDRAW;
437
+ }
438
+ 
439
+ void
440
+diff --git a/st.h b/st.h
441
+index 38c61c4..fc68c3b 100644
442
+--- a/st.h
443
++++ b/st.h
444
+@@ -33,6 +33,7 @@ enum glyph_attribute {
445
+ 	ATTR_WRAP       = 1 << 8,
446
+ 	ATTR_WIDE       = 1 << 9,
447
+ 	ATTR_WDUMMY     = 1 << 10,
448
++	ATTR_BOXDRAW    = 1 << 11,
449
+ 	ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
450
+ };
451
+ 
452
+@@ -110,6 +111,13 @@ void *xmalloc(size_t);
453
+ void *xrealloc(void *, size_t);
454
+ char *xstrdup(char *);
455
+ 
456
++int isboxdraw(const Glyph *);
457
++ushort boxdrawindex(const Glyph *);
458
++#ifdef XFT_VERSION
459
++/* only exposed to x.c, otherwise we'll need Xft.h for the types */
460
++void drawboxes(XftDraw *, int, int, int, int, XftColor *, const XftGlyphFontSpec *, int);
461
++#endif
462
++
463
+ /* config.h globals */
464
+ extern char *utmp;
465
+ extern char *stty_args;
466
+@@ -120,3 +128,4 @@ extern char *termname;
467
+ extern unsigned int tabspaces;
468
+ extern unsigned int defaultfg;
469
+ extern unsigned int defaultbg;
470
++extern const int boxdraw;
471
+diff --git a/x.c b/x.c
472
+index 00cb6b1..730f525 100644
473
+--- a/x.c
474
++++ b/x.c
475
+@@ -1164,8 +1164,13 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
476
+ 			yp = winy + font->ascent;
477
+ 		}
478
+ 
479
+-		/* Lookup character index with default font. */
480
+-		glyphidx = XftCharIndex(xw.dpy, font->match, rune);
481
++		if (mode & ATTR_BOXDRAW) {
482
++			/* minor shoehorning: boxdraw uses only this ushort */
483
++			glyphidx = boxdrawindex(&glyphs[i]);
484
++		} else {
485
++			/* Lookup character index with default font. */
486
++			glyphidx = XftCharIndex(xw.dpy, font->match, rune);
487
++		}
488
+ 		if (glyphidx) {
489
+ 			specs[numspecs].font = font->match;
490
+ 			specs[numspecs].glyph = glyphidx;
491
+@@ -1372,8 +1377,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
492
+ 	r.width = width;
493
+ 	XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
494
+ 
495
+-	/* Render the glyphs. */
496
+-	XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
497
++	if (base.mode & ATTR_BOXDRAW) {
498
++		drawboxes(xw.draw, winx, winy, width / len, win.ch, fg, specs, len);
499
++	} else {
500
++		/* Render the glyphs. */
501
++		XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
502
++	}
503
+ 
504
+ 	/* Render underline and strikethrough. */
505
+ 	if (base.mode & ATTR_UNDERLINE) {
506
+@@ -1416,7 +1425,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
507
+ 	/*
508
+ 	 * Select the right color for the right mode.
509
+ 	 */
510
+-	g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE;
511
++	g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE|ATTR_BOXDRAW;
512
+ 
513
+ 	if (IS_SET(MODE_REVERSE)) {
514
+ 		g.mode |= ATTR_REVERSE;
515
+-- 
516
+2.19.1
517
+

+ 74
- 0
st-bright-bold-text.patch View File

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

+ 17
- 0
st-config-mk.patch View File

@@ -0,0 +1,17 @@
1
+--- a/config.mk
2
++++ b/config.mk
3
+@@ -4,7 +4,7 @@
4
+ # Customize below to fit your system
5
+ 
6
+ # paths
7
+-PREFIX = /usr/local
8
++PREFIX = $(HOME)/.local
9
+ MANPREFIX = $(PREFIX)/share/man
10
+ 
11
+ X11INC = /usr/X11R6/include
12
+@@ -30,4 +30,4 @@
13
+ #       `pkg-config --libs freetype2`
14
+ 
15
+ # compiler and linker
16
+-# CC = c99
17
++CC = tcc

+ 45
- 0
st-disable-bold-italic-fonts.patch View File

@@ -0,0 +1,45 @@
1
+--- a/config.def.h
2
++++ b/config.def.h
3
+@@ -8,6 +8,10 @@
4
+ static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
5
+ static int borderpx = 2;
6
+ 
7
++/* disable bold and italic font styles */
8
++int disablebold = 0;
9
++int disableitalic = 0;
10
++
11
+ /*
12
+  * What program is execed by st depends of these precedence rules:
13
+  * 1: program passed with -e
14
+--- a/x.c
15
++++ b/x.c
16
+@@ -240,6 +240,10 @@ static char *opt_title = NULL;
17
+ 
18
+ static int oldbutton = 3; /* button event on startup: 3 = release */
19
+ 
20
++/* declared in config.h */
21
++extern int disablebold;
22
++extern int disableitalic;
23
++
24
+ void
25
+ clipcopy(const Arg *dummy)
26
+ {
27
+@@ -1152,13 +1156,15 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
28
+ 			frcflags = FRC_NORMAL;
29
+ 			runewidth = win.cw * ((mode & ATTR_WIDE) ? 2.0f : 1.0f);
30
+ 			if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) {
31
+-				font = &dc.ibfont;
32
++				if (!disableitalic && !disablebold) font = &dc.ibfont;
33
++				if (disableitalic && !disablebold) font = &dc.bfont;
34
++				if (!disableitalic && disablebold) font = &dc.ifont;
35
+ 				frcflags = FRC_ITALICBOLD;
36
+ 			} else if (mode & ATTR_ITALIC) {
37
+-				font = &dc.ifont;
38
++				if (!disableitalic) font = &dc.ifont;
39
+ 				frcflags = FRC_ITALIC;
40
+ 			} else if (mode & ATTR_BOLD) {
41
+-				font = &dc.bfont;
42
++				if (!disablebold) font = &dc.bfont;
43
+ 				frcflags = FRC_BOLD;
44
+ 			}
45
+ 			yp = winy + font->ascent;

+ 13
- 0
st-disable-intensity-styles.patch View File

@@ -0,0 +1,13 @@
1
+--- a/x.c
2
++++ b/x.c
3
+@@ -1296,10 +1296,6 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
4
+ 		bg = &dc.col[base.bg];
5
+ 	}
6
+ 
7
+-	/* Change basic system colors [0-7] to bright system colors [8-15] */
8
+-	if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
9
+-		fg = &dc.col[base.fg + 8];
10
+-
11
+ 	if (IS_SET(MODE_REVERSE)) {
12
+ 		if (fg == &dc.col[defaultfg]) {
13
+ 			fg = &dc.col[defaultbg];

+ 11
- 0
st-fix-argv.patch View File

@@ -0,0 +1,11 @@
1
+--- a/arg.h
2
++++ b/arg.h
3
+@@ -6,7 +6,7 @@
4
+ #ifndef ARG_H__
5
+ #define ARG_H__
6
+ 
7
+-extern char *argv0;
8
++static char *argv0;
9
+ 
10
+ /* use main(int argc, char *argv[]) */
11
+ #define ARGBEGIN	for (argv0 = *argv, argv++, argc--;\

Loading…
Cancel
Save