termptydbl: be strict on what is wide and do not try to be smart.

Too bad if ❤ is considered single-width
terminology-1.9
Boris Faure 2 years ago
parent b2218b0d01
commit d3c15c59db
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
  1. 205
      src/bin/termptydbl.c
  2. 4
      tools/unicode_dbl_width.py

@ -13,7 +13,8 @@ _termpty_is_ambigous_wide(Eina_Unicode g)
{
case 0xA1: EINA_FALLTHROUGH;
case 0xA4: EINA_FALLTHROUGH;
case 0xA7 ... 0xAA: EINA_FALLTHROUGH;
case 0xA7 ... 0xA8: EINA_FALLTHROUGH;
case 0xAA: EINA_FALLTHROUGH;
case 0xAD ... 0xAE: EINA_FALLTHROUGH;
case 0xB0 ... 0xB4: EINA_FALLTHROUGH;
case 0xB6 ... 0xBA: EINA_FALLTHROUGH;
@ -80,9 +81,8 @@ _termpty_is_ambigous_wide(Eina_Unicode g)
case 0x2030: EINA_FALLTHROUGH;
case 0x2032 ... 0x2033: EINA_FALLTHROUGH;
case 0x2035: EINA_FALLTHROUGH;
case 0x203B ... 0x203C: EINA_FALLTHROUGH;
case 0x203B: EINA_FALLTHROUGH;
case 0x203E: EINA_FALLTHROUGH;
case 0x2049: EINA_FALLTHROUGH;
case 0x2074: EINA_FALLTHROUGH;
case 0x207F: EINA_FALLTHROUGH;
case 0x2081 ... 0x2084: EINA_FALLTHROUGH;
@ -95,14 +95,12 @@ _termpty_is_ambigous_wide(Eina_Unicode g)
case 0x2121 ... 0x2122: EINA_FALLTHROUGH;
case 0x2126: EINA_FALLTHROUGH;
case 0x212B: EINA_FALLTHROUGH;
case 0x2139: EINA_FALLTHROUGH;
case 0x2153 ... 0x2154: EINA_FALLTHROUGH;
case 0x215B ... 0x215E: EINA_FALLTHROUGH;
case 0x2160 ... 0x216B: EINA_FALLTHROUGH;
case 0x2170 ... 0x2179: EINA_FALLTHROUGH;
case 0x2189: EINA_FALLTHROUGH;
case 0x2190 ... 0x2199: EINA_FALLTHROUGH;
case 0x21A9 ... 0x21AA: EINA_FALLTHROUGH;
case 0x21B8 ... 0x21B9: EINA_FALLTHROUGH;
case 0x21D2: EINA_FALLTHROUGH;
case 0x21D4: EINA_FALLTHROUGH;
@ -137,17 +135,17 @@ _termpty_is_ambigous_wide(Eina_Unicode g)
case 0x22BF: EINA_FALLTHROUGH;
case 0x2312: EINA_FALLTHROUGH;
case 0x231A ... 0x231B: EINA_FALLTHROUGH;
case 0x2328 ... 0x232A: EINA_FALLTHROUGH;
case 0x23CF: EINA_FALLTHROUGH;
case 0x23E9 ... 0x23F3: EINA_FALLTHROUGH;
case 0x23F8 ... 0x23FA: EINA_FALLTHROUGH;
case 0x2329 ... 0x232A: EINA_FALLTHROUGH;
case 0x23E9 ... 0x23EC: EINA_FALLTHROUGH;
case 0x23F0: EINA_FALLTHROUGH;
case 0x23F3: EINA_FALLTHROUGH;
case 0x2460 ... 0x24E9: EINA_FALLTHROUGH;
case 0x24EB ... 0x254B: EINA_FALLTHROUGH;
case 0x2550 ... 0x2573: EINA_FALLTHROUGH;
case 0x2580 ... 0x258F: EINA_FALLTHROUGH;
case 0x2592 ... 0x2595: EINA_FALLTHROUGH;
case 0x25A0 ... 0x25A1: EINA_FALLTHROUGH;
case 0x25A3 ... 0x25AB: EINA_FALLTHROUGH;
case 0x25A3 ... 0x25A9: EINA_FALLTHROUGH;
case 0x25B2 ... 0x25B3: EINA_FALLTHROUGH;
case 0x25B6 ... 0x25B7: EINA_FALLTHROUGH;
case 0x25BC ... 0x25BD: EINA_FALLTHROUGH;
@ -157,66 +155,42 @@ _termpty_is_ambigous_wide(Eina_Unicode g)
case 0x25CE ... 0x25D1: EINA_FALLTHROUGH;
case 0x25E2 ... 0x25E5: EINA_FALLTHROUGH;
case 0x25EF: EINA_FALLTHROUGH;
case 0x25FB ... 0x25FE: EINA_FALLTHROUGH;
case 0x2600 ... 0x2606: EINA_FALLTHROUGH;
case 0x25FD ... 0x25FE: EINA_FALLTHROUGH;
case 0x2605 ... 0x2606: EINA_FALLTHROUGH;
case 0x2609: EINA_FALLTHROUGH;
case 0x260E ... 0x260F: EINA_FALLTHROUGH;
case 0x2611: EINA_FALLTHROUGH;
case 0x2614 ... 0x2615: EINA_FALLTHROUGH;
case 0x2618: EINA_FALLTHROUGH;
case 0x261C ... 0x261E: EINA_FALLTHROUGH;
case 0x2620: EINA_FALLTHROUGH;
case 0x2622 ... 0x2623: EINA_FALLTHROUGH;
case 0x2626: EINA_FALLTHROUGH;
case 0x262A: EINA_FALLTHROUGH;
case 0x262E ... 0x262F: EINA_FALLTHROUGH;
case 0x2638 ... 0x263A: EINA_FALLTHROUGH;
case 0x261C: EINA_FALLTHROUGH;
case 0x261E: EINA_FALLTHROUGH;
case 0x2640: EINA_FALLTHROUGH;
case 0x2642: EINA_FALLTHROUGH;
case 0x2648 ... 0x2653: EINA_FALLTHROUGH;
case 0x265F ... 0x2661: EINA_FALLTHROUGH;
case 0x2663 ... 0x266A: EINA_FALLTHROUGH;
case 0x2660 ... 0x2661: EINA_FALLTHROUGH;
case 0x2663 ... 0x2665: EINA_FALLTHROUGH;
case 0x2667 ... 0x266A: EINA_FALLTHROUGH;
case 0x266C ... 0x266D: EINA_FALLTHROUGH;
case 0x266F: EINA_FALLTHROUGH;
case 0x267B: EINA_FALLTHROUGH;
case 0x267E ... 0x267F: EINA_FALLTHROUGH;
case 0x2692 ... 0x2697: EINA_FALLTHROUGH;
case 0x2699: EINA_FALLTHROUGH;
case 0x269B ... 0x269C: EINA_FALLTHROUGH;
case 0x269E ... 0x26A1: EINA_FALLTHROUGH;
case 0x26A7: EINA_FALLTHROUGH;
case 0x267F: EINA_FALLTHROUGH;
case 0x2693: EINA_FALLTHROUGH;
case 0x269E ... 0x269F: EINA_FALLTHROUGH;
case 0x26A1: EINA_FALLTHROUGH;
case 0x26AA ... 0x26AB: EINA_FALLTHROUGH;
case 0x26B0 ... 0x26B1: EINA_FALLTHROUGH;
case 0x26BD ... 0x26BF: EINA_FALLTHROUGH;
case 0x26C4 ... 0x26E1: EINA_FALLTHROUGH;
case 0x26E3: EINA_FALLTHROUGH;
case 0x26E8 ... 0x26FF: EINA_FALLTHROUGH;
case 0x2702: EINA_FALLTHROUGH;
case 0x2705: EINA_FALLTHROUGH;
case 0x2708 ... 0x270D: EINA_FALLTHROUGH;
case 0x270F: EINA_FALLTHROUGH;
case 0x2712: EINA_FALLTHROUGH;
case 0x2714: EINA_FALLTHROUGH;
case 0x2716: EINA_FALLTHROUGH;
case 0x271D: EINA_FALLTHROUGH;
case 0x2721: EINA_FALLTHROUGH;
case 0x270A ... 0x270B: EINA_FALLTHROUGH;
case 0x2728: EINA_FALLTHROUGH;
case 0x2733 ... 0x2734: EINA_FALLTHROUGH;
case 0x273D: EINA_FALLTHROUGH;
case 0x2744: EINA_FALLTHROUGH;
case 0x2747: EINA_FALLTHROUGH;
case 0x274C: EINA_FALLTHROUGH;
case 0x274E: EINA_FALLTHROUGH;
case 0x2753 ... 0x2755: EINA_FALLTHROUGH;
case 0x2757: EINA_FALLTHROUGH;
case 0x2763 ... 0x2764: EINA_FALLTHROUGH;
case 0x2776 ... 0x277F: EINA_FALLTHROUGH;
case 0x2795 ... 0x2797: EINA_FALLTHROUGH;
case 0x27A1: EINA_FALLTHROUGH;
case 0x27B0: EINA_FALLTHROUGH;
case 0x27BF: EINA_FALLTHROUGH;
case 0x2934 ... 0x2935: EINA_FALLTHROUGH;
case 0x2B05 ... 0x2B07: EINA_FALLTHROUGH;
case 0x2B1B ... 0x2B1C: EINA_FALLTHROUGH;
case 0x2B50: EINA_FALLTHROUGH;
case 0x2B55 ... 0x2B59: EINA_FALLTHROUGH;
@ -238,13 +212,30 @@ _termpty_is_ambigous_wide(Eina_Unicode g)
case 0x1F110 ... 0x1F12D: EINA_FALLTHROUGH;
case 0x1F130 ... 0x1F169: EINA_FALLTHROUGH;
case 0x1F170 ... 0x1F1AC: EINA_FALLTHROUGH;
case 0x1F200 ... 0x1F64F: EINA_FALLTHROUGH;
case 0x1F200 ... 0x1F320: EINA_FALLTHROUGH;
case 0x1F32D ... 0x1F335: EINA_FALLTHROUGH;
case 0x1F337 ... 0x1F37C: EINA_FALLTHROUGH;
case 0x1F37E ... 0x1F393: EINA_FALLTHROUGH;
case 0x1F3A0 ... 0x1F3CA: EINA_FALLTHROUGH;
case 0x1F3CF ... 0x1F3D3: EINA_FALLTHROUGH;
case 0x1F3E0 ... 0x1F3F0: EINA_FALLTHROUGH;
case 0x1F3F4: EINA_FALLTHROUGH;
case 0x1F3F8 ... 0x1F43E: EINA_FALLTHROUGH;
case 0x1F440: EINA_FALLTHROUGH;
case 0x1F442 ... 0x1F4FC: EINA_FALLTHROUGH;
case 0x1F4FF ... 0x1F53D: EINA_FALLTHROUGH;
case 0x1F54B ... 0x1F54E: EINA_FALLTHROUGH;
case 0x1F550 ... 0x1F567: EINA_FALLTHROUGH;
case 0x1F57A: EINA_FALLTHROUGH;
case 0x1F595 ... 0x1F596: EINA_FALLTHROUGH;
case 0x1F5A4: EINA_FALLTHROUGH;
case 0x1F5FB ... 0x1F64F: EINA_FALLTHROUGH;
case 0x1F680 ... 0x1F6C5: EINA_FALLTHROUGH;
case 0x1F6CB ... 0x1F6D2: EINA_FALLTHROUGH;
case 0x1F6D5 ... 0x1F6E5: EINA_FALLTHROUGH;
case 0x1F6E9: EINA_FALLTHROUGH;
case 0x1F6EB ... 0x1F6F0: EINA_FALLTHROUGH;
case 0x1F6F3 ... 0x1F6FC: EINA_FALLTHROUGH;
case 0x1F6CC: EINA_FALLTHROUGH;
case 0x1F6D0 ... 0x1F6D2: EINA_FALLTHROUGH;
case 0x1F6D5 ... 0x1F6D7: EINA_FALLTHROUGH;
case 0x1F6EB ... 0x1F6EC: EINA_FALLTHROUGH;
case 0x1F6F4 ... 0x1F6FC: EINA_FALLTHROUGH;
case 0x1F7E0 ... 0x1F7EB: EINA_FALLTHROUGH;
case 0x1F90C ... 0x1F93A: EINA_FALLTHROUGH;
case 0x1F93C ... 0x1F945: EINA_FALLTHROUGH;
@ -264,87 +255,38 @@ _termpty_is_wide(Eina_Unicode g)
{
switch (g)
{
case 0xA9: EINA_FALLTHROUGH;
case 0xAE: EINA_FALLTHROUGH;
case 0x1100 ... 0x115F: EINA_FALLTHROUGH;
case 0x203C: EINA_FALLTHROUGH;
case 0x2049: EINA_FALLTHROUGH;
case 0x2122: EINA_FALLTHROUGH;
case 0x2139: EINA_FALLTHROUGH;
case 0x2194 ... 0x2199: EINA_FALLTHROUGH;
case 0x21A9 ... 0x21AA: EINA_FALLTHROUGH;
case 0x231A ... 0x231B: EINA_FALLTHROUGH;
case 0x2328 ... 0x232A: EINA_FALLTHROUGH;
case 0x23CF: EINA_FALLTHROUGH;
case 0x23E9 ... 0x23F3: EINA_FALLTHROUGH;
case 0x23F8 ... 0x23FA: EINA_FALLTHROUGH;
case 0x24C2: EINA_FALLTHROUGH;
case 0x25AA ... 0x25AB: EINA_FALLTHROUGH;
case 0x25B6: EINA_FALLTHROUGH;
case 0x25C0: EINA_FALLTHROUGH;
case 0x25FB ... 0x25FE: EINA_FALLTHROUGH;
case 0x2600 ... 0x2604: EINA_FALLTHROUGH;
case 0x260E: EINA_FALLTHROUGH;
case 0x2611: EINA_FALLTHROUGH;
case 0x2329 ... 0x232A: EINA_FALLTHROUGH;
case 0x23E9 ... 0x23EC: EINA_FALLTHROUGH;
case 0x23F0: EINA_FALLTHROUGH;
case 0x23F3: EINA_FALLTHROUGH;
case 0x25FD ... 0x25FE: EINA_FALLTHROUGH;
case 0x2614 ... 0x2615: EINA_FALLTHROUGH;
case 0x2618: EINA_FALLTHROUGH;
case 0x261D: EINA_FALLTHROUGH;
case 0x2620: EINA_FALLTHROUGH;
case 0x2622 ... 0x2623: EINA_FALLTHROUGH;
case 0x2626: EINA_FALLTHROUGH;
case 0x262A: EINA_FALLTHROUGH;
case 0x262E ... 0x262F: EINA_FALLTHROUGH;
case 0x2638 ... 0x263A: EINA_FALLTHROUGH;
case 0x2640: EINA_FALLTHROUGH;
case 0x2642: EINA_FALLTHROUGH;
case 0x2648 ... 0x2653: EINA_FALLTHROUGH;
case 0x265F ... 0x2660: EINA_FALLTHROUGH;
case 0x2663: EINA_FALLTHROUGH;
case 0x2665 ... 0x2666: EINA_FALLTHROUGH;
case 0x2668: EINA_FALLTHROUGH;
case 0x267B: EINA_FALLTHROUGH;
case 0x267E ... 0x267F: EINA_FALLTHROUGH;
case 0x2692 ... 0x2697: EINA_FALLTHROUGH;
case 0x2699: EINA_FALLTHROUGH;
case 0x269B ... 0x269C: EINA_FALLTHROUGH;
case 0x26A0 ... 0x26A1: EINA_FALLTHROUGH;
case 0x26A7: EINA_FALLTHROUGH;
case 0x267F: EINA_FALLTHROUGH;
case 0x2693: EINA_FALLTHROUGH;
case 0x26A1: EINA_FALLTHROUGH;
case 0x26AA ... 0x26AB: EINA_FALLTHROUGH;
case 0x26B0 ... 0x26B1: EINA_FALLTHROUGH;
case 0x26BD ... 0x26BE: EINA_FALLTHROUGH;
case 0x26C4 ... 0x26C5: EINA_FALLTHROUGH;
case 0x26C8: EINA_FALLTHROUGH;
case 0x26CE ... 0x26CF: EINA_FALLTHROUGH;
case 0x26D1: EINA_FALLTHROUGH;
case 0x26D3 ... 0x26D4: EINA_FALLTHROUGH;
case 0x26E9 ... 0x26EA: EINA_FALLTHROUGH;
case 0x26F0 ... 0x26F5: EINA_FALLTHROUGH;
case 0x26F7 ... 0x26FA: EINA_FALLTHROUGH;
case 0x26CE: EINA_FALLTHROUGH;
case 0x26D4: EINA_FALLTHROUGH;
case 0x26EA: EINA_FALLTHROUGH;
case 0x26F2 ... 0x26F3: EINA_FALLTHROUGH;
case 0x26F5: EINA_FALLTHROUGH;
case 0x26FA: EINA_FALLTHROUGH;
case 0x26FD: EINA_FALLTHROUGH;
case 0x2702: EINA_FALLTHROUGH;
case 0x2705: EINA_FALLTHROUGH;
case 0x2708 ... 0x270D: EINA_FALLTHROUGH;
case 0x270F: EINA_FALLTHROUGH;
case 0x2712: EINA_FALLTHROUGH;
case 0x2714: EINA_FALLTHROUGH;
case 0x2716: EINA_FALLTHROUGH;
case 0x271D: EINA_FALLTHROUGH;
case 0x2721: EINA_FALLTHROUGH;
case 0x270A ... 0x270B: EINA_FALLTHROUGH;
case 0x2728: EINA_FALLTHROUGH;
case 0x2733 ... 0x2734: EINA_FALLTHROUGH;
case 0x2744: EINA_FALLTHROUGH;
case 0x2747: EINA_FALLTHROUGH;
case 0x274C: EINA_FALLTHROUGH;
case 0x274E: EINA_FALLTHROUGH;
case 0x2753 ... 0x2755: EINA_FALLTHROUGH;
case 0x2757: EINA_FALLTHROUGH;
case 0x2763 ... 0x2764: EINA_FALLTHROUGH;
case 0x2795 ... 0x2797: EINA_FALLTHROUGH;
case 0x27A1: EINA_FALLTHROUGH;
case 0x27B0: EINA_FALLTHROUGH;
case 0x27BF: EINA_FALLTHROUGH;
case 0x2934 ... 0x2935: EINA_FALLTHROUGH;
case 0x2B05 ... 0x2B07: EINA_FALLTHROUGH;
case 0x2B1B ... 0x2B1C: EINA_FALLTHROUGH;
case 0x2B50: EINA_FALLTHROUGH;
case 0x2B55: EINA_FALLTHROUGH;
@ -362,17 +304,32 @@ _termpty_is_wide(Eina_Unicode g)
case 0x16FE0 ... 0x1B2FB: EINA_FALLTHROUGH;
case 0x1F004: EINA_FALLTHROUGH;
case 0x1F0CF: EINA_FALLTHROUGH;
case 0x1F170 ... 0x1F171: EINA_FALLTHROUGH;
case 0x1F17E ... 0x1F17F: EINA_FALLTHROUGH;
case 0x1F18E: EINA_FALLTHROUGH;
case 0x1F191 ... 0x1F19A: EINA_FALLTHROUGH;
case 0x1F200 ... 0x1F64F: EINA_FALLTHROUGH;
case 0x1F200 ... 0x1F320: EINA_FALLTHROUGH;
case 0x1F32D ... 0x1F335: EINA_FALLTHROUGH;
case 0x1F337 ... 0x1F37C: EINA_FALLTHROUGH;
case 0x1F37E ... 0x1F393: EINA_FALLTHROUGH;
case 0x1F3A0 ... 0x1F3CA: EINA_FALLTHROUGH;
case 0x1F3CF ... 0x1F3D3: EINA_FALLTHROUGH;
case 0x1F3E0 ... 0x1F3F0: EINA_FALLTHROUGH;
case 0x1F3F4: EINA_FALLTHROUGH;
case 0x1F3F8 ... 0x1F43E: EINA_FALLTHROUGH;
case 0x1F440: EINA_FALLTHROUGH;
case 0x1F442 ... 0x1F4FC: EINA_FALLTHROUGH;
case 0x1F4FF ... 0x1F53D: EINA_FALLTHROUGH;
case 0x1F54B ... 0x1F54E: EINA_FALLTHROUGH;
case 0x1F550 ... 0x1F567: EINA_FALLTHROUGH;
case 0x1F57A: EINA_FALLTHROUGH;
case 0x1F595 ... 0x1F596: EINA_FALLTHROUGH;
case 0x1F5A4: EINA_FALLTHROUGH;
case 0x1F5FB ... 0x1F64F: EINA_FALLTHROUGH;
case 0x1F680 ... 0x1F6C5: EINA_FALLTHROUGH;
case 0x1F6CB ... 0x1F6D2: EINA_FALLTHROUGH;
case 0x1F6D5 ... 0x1F6E5: EINA_FALLTHROUGH;
case 0x1F6E9: EINA_FALLTHROUGH;
case 0x1F6EB ... 0x1F6F0: EINA_FALLTHROUGH;
case 0x1F6F3 ... 0x1F6FC: EINA_FALLTHROUGH;
case 0x1F6CC: EINA_FALLTHROUGH;
case 0x1F6D0 ... 0x1F6D2: EINA_FALLTHROUGH;
case 0x1F6D5 ... 0x1F6D7: EINA_FALLTHROUGH;
case 0x1F6EB ... 0x1F6EC: EINA_FALLTHROUGH;
case 0x1F6F4 ... 0x1F6FC: EINA_FALLTHROUGH;
case 0x1F7E0 ... 0x1F7EB: EINA_FALLTHROUGH;
case 0x1F90C ... 0x1F93A: EINA_FALLTHROUGH;
case 0x1F93C ... 0x1F945: EINA_FALLTHROUGH;

@ -32,7 +32,7 @@ def get_ranges(xmlfile, emoji_as_wide):
if emoji_as_wide:
ext_pic = c.get('ExtPict')
emoji = c.get('Emoji')
if emoji == 'Y' and ext_pic == 'Y':
if emoji == 'Y' and ext_pic == 'Y' and ea != 'A':
ea = 'W'
else:
blk = c.get('blk')
@ -190,5 +190,5 @@ parser.add_argument('source', type=argparse.FileType('w'))
args = parser.parse_args()
ranges = get_ranges(args.xml, True)
ranges = get_ranges(args.xml, False)
gen_c(ranges, args.header, args.source)

Loading…
Cancel
Save