aboutsummarylogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorAnders Eurenius2014-06-21 20:29:36 +0200
committerRoberto E. Vargas Caballero2014-06-27 14:04:47 +0200
commit10c3765c271ebf77b7f5c98169ae53bdb9cb0eec (patch)
treeb54ad553f0c1834c9da70b6e9622e53b3832c20b /st.c
parented5e2dc4c99d27033de5ece87bc621a9fe021b53 (diff)
downloadaur-10c3765c271ebf77b7f5c98169ae53bdb9cb0eec.tar.gz
Reorder and extend glyph attributes
Faint, invisible, struck and fast blink are added as glyph attributes. Since there's an edit here, let's take the opportunity to reorder them so that they correspond to the two's power of the corresponding escape code. (just for neatness, let's hope that property never gets used for anything.) Signed-off-by: Roberto E. Vargas Caballero <k0ga@shike2.com>
Diffstat (limited to 'st.c')
-rw-r--r--st.c60
1 files changed, 46 insertions, 14 deletions
diff --git a/st.c b/st.c
index 2b6b7171b4b6..96378343746d 100644
--- a/st.c
+++ b/st.c
@@ -89,15 +89,19 @@ char *argv0;
#define VT102ID "\033[?6c"
enum glyph_attribute {
- ATTR_NULL = 0,
- ATTR_REVERSE = 1,
- ATTR_UNDERLINE = 2,
- ATTR_BOLD = 4,
- ATTR_ITALIC = 8,
+ ATTR_NULL = 0,
+ ATTR_BOLD = 1,
+ ATTR_FAINT = 2,
+ ATTR_ITALIC = 4,
+ ATTR_UNDERLINE = 8,
ATTR_BLINK = 16,
- ATTR_WRAP = 32,
- ATTR_WIDE = 64,
- ATTR_WDUMMY = 128,
+ ATTR_FASTBLINK = 32,
+ ATTR_REVERSE = 64,
+ ATTR_INVISIBLE = 128,
+ ATTR_STRUCK = 256,
+ ATTR_WRAP = 512,
+ ATTR_WIDE = 1024,
+ ATTR_WDUMMY = 2048,
};
enum cursor_movement {
@@ -1681,15 +1685,25 @@ tsetattr(int *attr, int l) {
for(i = 0; i < l; i++) {
switch(attr[i]) {
case 0:
- term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE \
- | ATTR_BOLD | ATTR_ITALIC \
- | ATTR_BLINK);
+ term.c.attr.mode &= ~(
+ ATTR_BOLD |
+ ATTR_FAINT |
+ ATTR_ITALIC |
+ ATTR_UNDERLINE |
+ ATTR_BLINK |
+ ATTR_FASTBLINK |
+ ATTR_REVERSE |
+ ATTR_INVISIBLE |
+ ATTR_STRUCK );
term.c.attr.fg = defaultfg;
term.c.attr.bg = defaultbg;
break;
case 1:
term.c.attr.mode |= ATTR_BOLD;
break;
+ case 2:
+ term.c.attr.mode |= ATTR_FAINT;
+ break;
case 3:
term.c.attr.mode |= ATTR_ITALIC;
break;
@@ -1697,16 +1711,26 @@ tsetattr(int *attr, int l) {
term.c.attr.mode |= ATTR_UNDERLINE;
break;
case 5: /* slow blink */
- case 6: /* rapid blink */
term.c.attr.mode |= ATTR_BLINK;
break;
+ case 6: /* rapid blink */
+ term.c.attr.mode |= ATTR_FASTBLINK;
+ break;
case 7:
term.c.attr.mode |= ATTR_REVERSE;
break;
+ case 8:
+ term.c.attr.mode |= ATTR_INVISIBLE;
+ break;
+ case 9:
+ term.c.attr.mode |= ATTR_STRUCK;
+ break;
case 21:
- case 22:
term.c.attr.mode &= ~ATTR_BOLD;
break;
+ case 22:
+ term.c.attr.mode &= ~ATTR_FAINT;
+ break;
case 23:
term.c.attr.mode &= ~ATTR_ITALIC;
break;
@@ -1714,12 +1738,20 @@ tsetattr(int *attr, int l) {
term.c.attr.mode &= ~ATTR_UNDERLINE;
break;
case 25:
- case 26:
term.c.attr.mode &= ~ATTR_BLINK;
break;
+ case 26:
+ term.c.attr.mode &= ~ATTR_FASTBLINK;
+ break;
case 27:
term.c.attr.mode &= ~ATTR_REVERSE;
break;
+ case 28:
+ term.c.attr.mode &= ~ATTR_INVISIBLE;
+ break;
+ case 29:
+ term.c.attr.mode &= ~ATTR_STRUCK;
+ break;
case 38:
if ((idx = tdefcolor(attr, &i, l)) >= 0)
term.c.attr.fg = idx;