Skip to content

Commit

Permalink
support encircled escape code. Closes T6769
Browse files Browse the repository at this point in the history
  • Loading branch information
borisfaure committed Mar 13, 2018
1 parent deaadfe commit 9e0243d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bin/termpty.h
Expand Up @@ -64,11 +64,14 @@ struct _Termatt
unsigned short autowrapped : 1;
unsigned short newline : 1;
unsigned short fraktur : 1;
unsigned short framed : 1;
unsigned short encircled : 1;
unsigned short overlined : 1;
#if defined(SUPPORT_80_132_COLUMNS)
unsigned short is_80_132_mode_allowed : 1;
unsigned short bit_padding : 14;
unsigned short bit_padding : 11;
#else
unsigned short bit_padding : 15;
unsigned short bit_padding : 12;
#endif
};

Expand Down
18 changes: 18 additions & 0 deletions src/bin/termptyesc.c
Expand Up @@ -847,6 +847,24 @@ _handle_esc_csi_color_set(Termpty *ty, Eina_Unicode **ptr)
ty->termstate.att.bg = COL_DEF;
ty->termstate.att.bgintense = 0;
break;
case 51:
WRN("TODO: support SGR 51 - framed attribute");
ty->termstate.att.framed = 1;
break;
case 52:
ty->termstate.att.encircled = 1;
break;
case 53:
WRN("TODO: support SGR 51 - overlined attribute");
ty->termstate.att.overlined = 1;
break;
case 54:
ty->termstate.att.framed = 0;
ty->termstate.att.encircled = 0;
break;
case 55:
ty->termstate.att.overlined = 0;
break;
case 90: // fg
case 91:
case 92:
Expand Down
17 changes: 17 additions & 0 deletions src/bin/termptygfx.c
Expand Up @@ -60,5 +60,22 @@ _termpty_charset_trans(const Termpty *ty, Eina_Unicode g)
g += 0x1d504 - 'A';
}
}
else if (ty->termstate.att.encircled)
{
if (g >= 'a' && g <= 'z')
{
g += 0x24d0 - 'a';
}
else if (g >= 'A' && g <= 'Z')
{
g += 0x24b6 - 'A';
}
else if (g >= '1' && g <= '9')
{
g += 0x2460 - '0';
}
else if (g == '0')
g = 0x24ea;
}
return g;
}
3 changes: 3 additions & 0 deletions src/bin/termptyops.c
Expand Up @@ -418,6 +418,9 @@ termpty_reset_att(Termatt *att)
att->autowrapped = 0;
att->newline = 0;
att->fraktur = 0;
att->framed = 0;
att->encircled = 0;
att->overlined = 0;
}

void
Expand Down
4 changes: 4 additions & 0 deletions tools/fonts.sh
Expand Up @@ -18,3 +18,7 @@ echo -ne "\033[3;1mABCDEFGHIJKLMNOPQRSTUVWXYZ\n\033[0m"
echo -ne "\nfraktur\n"
echo -ne "\033[20mabcdefghijklmnopqrstuvwxyz\n\033[0m"
echo -ne "\033[20mABCDEFGHIJKLMNOPQRSTUVWXYZ\n\033[0m"

echo -ne "\nencircled\n"
echo -ne "\033[52ma b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4\n\033[0m"
echo -ne "\033[52mA B C D E F G H I J K L M N O P Q R S T U V W X Y Z 5 6 7 8 9\n\033[0m"

0 comments on commit 9e0243d

Please sign in to comment.