Re: [dev] [PATCH] Reorder-and-extend-glyph-attributes

From: Ivan Delalande <colona_AT_ycc.fr>
Date: Sat, 26 Jul 2014 20:28:00 +0200

Hi,

On Tue, Jun 24, 2014 at 11:45:42PM +0200, Anders Eurenius wrote:
> From eedd5902aa34efb9d2cd7bd2565286753a318c64 Mon Sep 17 00:00:00 2001
> From: Anders Eurenius <aes_AT_spotify.com>
> Date: Sat, 21 Jun 2014 20:29:36 +0200
> Subject: [PATCH 1/8] 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.)

The SGR part of your patch (in tsetattr) is modified quite a bit by
Michael Forney in his last patch posted on the ML[0]. So I’m curious
about where you found these behaviors, did you follow any kind of
reference for your own patch?

Thanks,

[0] http://lists.suckless.org/dev/1407/23144.html

> ---
> st.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 46 insertions(+), 14 deletions(-)
>
> diff --git a/st.c b/st.c
> index 26053b0..4ffb3df 100644
> --- a/st.c
> +++ b/st.c
> _AT_@ -90,15 +90,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 {
> _AT_@ -1682,15 +1686,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;
> _AT_@ -1698,16 +1712,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;
> _AT_@ -1715,12 +1739,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;
> --
> 2.0.0
>

-- 
Ivan "Colona" Delalande
Received on Sat Jul 26 2014 - 20:28:00 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 26 2014 - 20:36:06 CEST