diff options
author | Anders Eurenius <aes@spotify.com> | 2014-06-21 20:29:36 +0200 |
---|---|---|
committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-06-27 14:04:47 +0200 |
commit | 50e6355e0d6c9843b51ac4711980401205ce06c1 (patch) | |
tree | c07bfe2b32824404875e682018648d6320a04959 | |
parent | 77569526c0166e6364bb635fceb8eeabd58ce683 (diff) | |
download | st-50e6355e0d6c9843b51ac4711980401205ce06c1.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>
-rw-r--r-- | st.c | 60 |
1 files changed, 46 insertions, 14 deletions
@@ -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; |