Fixes character width issue in CJK environment.
PR: ports/102777 Submitted by: Yi-Hsuan Hsin <mhsin_at_mhsin_dot_org>
This commit is contained in:
parent
f366de4190
commit
9d66165590
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=171887
2 changed files with 169 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
|||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= chinese
|
||||
|
||||
MAINTAINER= vanilla@FreeBSD.org
|
||||
|
@ -14,6 +14,7 @@ COMMENT= A zh-tw cursor movement friendly, wrapping clean irssi
|
|||
MASTERDIR= ${.CURDIR}/../../irc/irssi
|
||||
|
||||
EXTRA_PATCHES= ${.CURDIR}/files/patch-irssi.conf \
|
||||
${.CURDIR}/files/patch-utf8_break
|
||||
${.CURDIR}/files/patch-utf8_break \
|
||||
${.CURDIR}/files/patch-eaw
|
||||
|
||||
.include "${MASTERDIR}/Makefile"
|
||||
|
|
166
chinese/irssi/files/patch-eaw
Normal file
166
chinese/irssi/files/patch-eaw
Normal file
|
@ -0,0 +1,166 @@
|
|||
--- src/fe-common/core/utf8.c.orig Sat Sep 2 13:59:46 2006
|
||||
+++ src/fe-common/core/utf8.c Sat Sep 2 14:40:26 2006
|
||||
@@ -201,29 +201,72 @@
|
||||
}
|
||||
|
||||
static const unichar wcc[] = {
|
||||
- 0x0, 0x300, 0x34F, 0x360, 0x363, 0x483, 0x487, 0x488, 0x48A, 0x591,
|
||||
- 0x5A2, 0x5A3, 0x5BA, 0x5BB, 0x5BE, 0x5BF, 0x5C0, 0x5C1, 0x5C3, 0x5C4,
|
||||
- 0x5C5, 0x64B, 0x656, 0x670, 0x671, 0x6D6, 0x6E5, 0x6E7, 0x6E9, 0x6EA,
|
||||
- 0x6EE, 0x70F, 0x710, 0x711, 0x712, 0x730, 0x74B, 0x7A6, 0x7B1, 0x901,
|
||||
- 0x903, 0x93C, 0x93D, 0x941, 0x949, 0x94D, 0x94E, 0x951, 0x955, 0x962,
|
||||
- 0x964, 0x981, 0x982, 0x9BC, 0x9BD, 0x9C1, 0x9C5, 0x9CD, 0x9CE, 0x9E2,
|
||||
- 0x9E4, 0xA02, 0xA03, 0xA3C, 0xA3D, 0xA41, 0xA43, 0xA47, 0xA49, 0xA4B,
|
||||
- 0xA4E, 0xA70, 0xA72, 0xA81, 0xA83, 0xABC, 0xABD, 0xAC1, 0xAC6, 0xAC7,
|
||||
- 0xAC9, 0xACD, 0xACE, 0xB01, 0xB02, 0xB3C, 0xB3D, 0xB3F, 0xB40, 0xB41,
|
||||
- 0xB44, 0xB4D, 0xB4E, 0xB56, 0xB57, 0xB82, 0xB83, 0xBC0, 0xBC1, 0xBCD,
|
||||
- 0xBCE, 0xC3E, 0xC41, 0xC46, 0xC49, 0xC4A, 0xC4E, 0xC55, 0xC57, 0xCBF,
|
||||
- 0xCC0, 0xCC6, 0xCC7, 0xCCC, 0xCCE, 0xD41, 0xD44, 0xD4D, 0xD4E, 0xDCA,
|
||||
- 0xDCB, 0xDD2, 0xDD5, 0xDD6, 0xDD7, 0xE31, 0xE32, 0xE34, 0xE3B, 0xE47,
|
||||
- 0xE4F, 0xEB1, 0xEB2, 0xEB4, 0xEBA, 0xEBB, 0xEBD, 0xEC8, 0xECE, 0xF18,
|
||||
- 0xF1A, 0xF35, 0xF36, 0xF37, 0xF38, 0xF39, 0xF3A, 0xF71, 0xF7F, 0xF80,
|
||||
- 0xF85, 0xF86, 0xF88, 0xF90, 0xF98, 0xF99, 0xFBD, 0xFC6, 0xFC7, 0x102D,
|
||||
- 0x1031, 0x1032, 0x1033, 0x1036, 0x1038, 0x1039, 0x103A, 0x1058, 0x105A,
|
||||
- 0x1100, 0x1160, 0x17B7, 0x17BE, 0x17C6, 0x17C7, 0x17C9, 0x17D4, 0x180B,
|
||||
- 0x180F, 0x18A9, 0x18AA, 0x200B, 0x2010, 0x202A, 0x202F, 0x206A, 0x2070,
|
||||
- 0x20D0, 0x20E4, 0x2E80, 0x3008, 0x300C, 0x3014, 0x3016, 0x3018, 0x301C,
|
||||
- 0x302A, 0x3030, 0x303F, 0x3041, 0x3095, 0x3099, 0x309B, 0xA4C7, 0xAC00,
|
||||
- 0xD7A4, 0xF8F0, 0xF900, 0xFA2E, 0xFB1E, 0xFB1F, 0xFE20, 0xFE24, 0xFE30,
|
||||
- 0xFE6C, 0xFEFF, 0xFF00, 0xFF01, 0xFF5F, 0xFFE0, 0xFFE7, 0xFFF9, 0xFFFC,
|
||||
+ 0x0000, 0x00A1, 0x00A2, 0x00A4, 0x00A5, 0x00A7, 0x00A9, 0x00AA,
|
||||
+ 0x00AB, 0x00AE, 0x00AF, 0x00B0, 0x00B5, 0x00B6, 0x00BB, 0x00BC,
|
||||
+ 0x00C0, 0x00C6, 0x00C7, 0x00D0, 0x00D1, 0x00D7, 0x00D9, 0x00DE,
|
||||
+ 0x00E2, 0x00E6, 0x00E7, 0x00E8, 0x00EB, 0x00EC, 0x00EE, 0x00F0,
|
||||
+ 0x00F1, 0x00F2, 0x00F4, 0x00F7, 0x00FB, 0x00FC, 0x00FD, 0x00FE,
|
||||
+ 0x00FF, 0x0101, 0x0102, 0x0111, 0x0112, 0x0113, 0x0114, 0x011B,
|
||||
+ 0x011C, 0x0126, 0x0128, 0x012B, 0x012C, 0x0131, 0x0134, 0x0138,
|
||||
+ 0x0139, 0x013F, 0x0143, 0x0144, 0x0145, 0x0148, 0x014C, 0x014D,
|
||||
+ 0x014E, 0x0152, 0x0154, 0x0166, 0x0168, 0x016B, 0x016C, 0x01CE,
|
||||
+ 0x01CF, 0x01D0, 0x01D1, 0x01D2, 0x01D3, 0x01D4, 0x01D5, 0x01D6,
|
||||
+ 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DB, 0x01DC, 0x01DD, 0x0251,
|
||||
+ 0x0252, 0x0261, 0x0262, 0x02C4, 0x02C5, 0x02C7, 0x02C8, 0x02C9,
|
||||
+ 0x02CC, 0x02CD, 0x02CE, 0x02D0, 0x02D1, 0x02D8, 0x02DC, 0x02DD,
|
||||
+ 0x02DE, 0x02DF, 0x02E0, 0x0300, 0x034F, 0x0360, 0x0363, 0x0391,
|
||||
+ 0x03A2, 0x03A3, 0x03AA, 0x03B1, 0x03C2, 0x03C3, 0x03CA, 0x0401,
|
||||
+ 0x0402, 0x0410, 0x0450, 0x0451, 0x0452, 0x0483, 0x0487, 0x0488,
|
||||
+ 0x048A, 0x0591, 0x05A2, 0x05A3, 0x05BA, 0x05BB, 0x05BE, 0x05BF,
|
||||
+ 0x05C0, 0x05C1, 0x05C3, 0x05C4, 0x05C5, 0x064B, 0x0656, 0x0670,
|
||||
+ 0x0671, 0x06D6, 0x06E5, 0x06E7, 0x06E9, 0x06EA, 0x06EE, 0x070F,
|
||||
+ 0x0710, 0x0711, 0x0712, 0x0730, 0x074B, 0x07A6, 0x07B1, 0x0901,
|
||||
+ 0x0903, 0x093C, 0x093D, 0x0941, 0x0949, 0x094D, 0x094E, 0x0951,
|
||||
+ 0x0955, 0x0962, 0x0964, 0x0981, 0x0982, 0x09BC, 0x09BD, 0x09C1,
|
||||
+ 0x09C5, 0x09CD, 0x09CE, 0x09E2, 0x09E4, 0x0A02, 0x0A03, 0x0A3C,
|
||||
+ 0x0A3D, 0x0A41, 0x0A43, 0x0A47, 0x0A49, 0x0A4B, 0x0A4E, 0x0A70,
|
||||
+ 0x0A72, 0x0A81, 0x0A83, 0x0ABC, 0x0ABD, 0x0AC1, 0x0AC6, 0x0AC7,
|
||||
+ 0x0AC9, 0x0ACD, 0x0ACE, 0x0B01, 0x0B02, 0x0B3C, 0x0B3D, 0x0B3F,
|
||||
+ 0x0B40, 0x0B41, 0x0B44, 0x0B4D, 0x0B4E, 0x0B56, 0x0B57, 0x0B82,
|
||||
+ 0x0B83, 0x0BC0, 0x0BC1, 0x0BCD, 0x0BCE, 0x0C3E, 0x0C41, 0x0C46,
|
||||
+ 0x0C49, 0x0C4A, 0x0C4E, 0x0C55, 0x0C57, 0x0CBF, 0x0CC0, 0x0CC6,
|
||||
+ 0x0CC7, 0x0CCC, 0x0CCE, 0x0D41, 0x0D44, 0x0D4D, 0x0D4E, 0x0DCA,
|
||||
+ 0x0DCB, 0x0DD2, 0x0DD5, 0x0DD6, 0x0DD7, 0x0E31, 0x0E32, 0x0E34,
|
||||
+ 0x0E3B, 0x0E47, 0x0E4F, 0x0EB1, 0x0EB2, 0x0EB4, 0x0EBA, 0x0EBB,
|
||||
+ 0x0EBD, 0x0EC8, 0x0ECE, 0x0F18, 0x0F1A, 0x0F35, 0x0F36, 0x0F37,
|
||||
+ 0x0F38, 0x0F39, 0x0F3A, 0x0F71, 0x0F7F, 0x0F80, 0x0F85, 0x0F86,
|
||||
+ 0x0F88, 0x0F90, 0x0F98, 0x0F99, 0x0FBD, 0x0FC6, 0x0FC7, 0x102D,
|
||||
+ 0x1031, 0x1032, 0x1033, 0x1036, 0x1038, 0x1039, 0x103A, 0x1058,
|
||||
+ 0x105A, 0x1100, 0x1160, 0x17B7, 0x17BE, 0x17C6, 0x17C7, 0x17C9,
|
||||
+ 0x17D4, 0x180B, 0x180F, 0x18A9, 0x18AA, 0x200B, 0x2010, 0x2011,
|
||||
+ 0x2013, 0x2017, 0x2018, 0x201A, 0x201C, 0x201E, 0x2020, 0x2023,
|
||||
+ 0x2024, 0x2028, 0x202A, 0x202F, 0x2030, 0x2031, 0x2032, 0x2034,
|
||||
+ 0x2035, 0x2036, 0x203B, 0x203C, 0x203E, 0x203F, 0x206A, 0x2070,
|
||||
+ 0x2074, 0x2075, 0x207F, 0x2080, 0x2081, 0x2085, 0x20AC, 0x20AD,
|
||||
+ 0x20D0, 0x20E4, 0x2103, 0x2104, 0x2105, 0x2106, 0x2109, 0x210A,
|
||||
+ 0x2113, 0x2114, 0x2116, 0x2117, 0x2121, 0x2123, 0x2126, 0x2127,
|
||||
+ 0x212B, 0x212C, 0x2153, 0x2155, 0x215B, 0x215F, 0x2160, 0x216C,
|
||||
+ 0x2170, 0x217A, 0x2190, 0x219A, 0x21B8, 0x21BA, 0x21D2, 0x21D3,
|
||||
+ 0x21D4, 0x21D5, 0x21E7, 0x21E8, 0x2200, 0x2201, 0x2202, 0x2204,
|
||||
+ 0x2207, 0x2209, 0x220B, 0x220C, 0x220F, 0x2210, 0x2211, 0x2212,
|
||||
+ 0x2215, 0x2216, 0x221A, 0x221B, 0x221D, 0x2221, 0x2223, 0x2224,
|
||||
+ 0x2225, 0x2226, 0x2227, 0x222D, 0x222E, 0x222F, 0x2234, 0x2238,
|
||||
+ 0x223C, 0x223E, 0x2248, 0x2249, 0x224C, 0x224D, 0x2252, 0x2253,
|
||||
+ 0x2260, 0x2262, 0x2264, 0x2268, 0x226A, 0x226C, 0x226E, 0x2270,
|
||||
+ 0x2282, 0x2284, 0x2286, 0x2288, 0x2295, 0x2296, 0x2299, 0x229A,
|
||||
+ 0x22A5, 0x22A6, 0x22BF, 0x22C0, 0x2312, 0x2313, 0x2329, 0x232B,
|
||||
+ 0x2460, 0x24EA, 0x24EB, 0x254C, 0x2550, 0x2574, 0x2580, 0x2590,
|
||||
+ 0x2592, 0x2596, 0x25A0, 0x25A2, 0x25A3, 0x25AA, 0x25B2, 0x25B4,
|
||||
+ 0x25B6, 0x25B8, 0x25BC, 0x25BE, 0x25C0, 0x25C2, 0x25C6, 0x25C9,
|
||||
+ 0x25CB, 0x25CC, 0x25CE, 0x25D2, 0x25E2, 0x25E6, 0x25EF, 0x25F0,
|
||||
+ 0x2605, 0x2607, 0x2609, 0x260A, 0x260E, 0x2610, 0x2614, 0x2616,
|
||||
+ 0x261C, 0x261D, 0x261E, 0x261F, 0x2640, 0x2641, 0x2642, 0x2643,
|
||||
+ 0x2660, 0x2662, 0x2663, 0x2666, 0x2667, 0x266B, 0x266C, 0x266E,
|
||||
+ 0x266F, 0x2670, 0x273D, 0x273E, 0x2776, 0x2780, 0x2E80, 0x303F,
|
||||
+ 0x3041, 0x3097, 0x3099, 0xA4C7, 0xAC00, 0xD7A4, 0xE000, 0xF900,
|
||||
+ 0xFA2E, 0xFA30, 0xFA6B, 0xFA70, 0xFADA, 0xFB1E, 0xFB1F, 0xFE10,
|
||||
+ 0xFE1A, 0xFE20, 0xFE24, 0xFE30, 0xFE6C, 0xFEFF, 0xFF00, 0xFF01,
|
||||
+ 0xFF61, 0xFFE0, 0xFFE7, 0xFFF9, 0xFFFC, 0xFFFD, 0xFFFE,
|
||||
#if 1
|
||||
0x1D167, 0x1D16A, 0x1D173, 0x1D183, 0x1D185, 0x1D18C, 0x1D1AA, 0x1D1AE,
|
||||
0x20000, 0x2A6D7, 0x2F800, 0x2FA1E, 0xE0001, 0xE0002, 0xE0020, 0xE0080
|
||||
@@ -233,16 +276,43 @@
|
||||
static const int wccnum = sizeof(wcc) / sizeof(wcc[0]) - 1;
|
||||
|
||||
static const char wws[] = {
|
||||
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
- 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
- 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0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, 0,
|
||||
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
+ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
+ 1, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 0, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, 0, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ 0, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 2, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1,
|
||||
+ -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 2, 1,
|
||||
+ 2, 1, 2, 1, 2, 1, -1, 2, 1, 2, 1, 2, 1, 0, 1, 2,
|
||||
+ 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, -1, 1,
|
||||
+#if 1
|
||||
+ 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 2, 1, 0, 1, 0, 1,
|
||||
+#endif
|
||||
+ -1
|
||||
};
|
||||
|
||||
int utf8_width(unichar c)
|
||||
@@ -264,8 +334,11 @@
|
||||
else if (d > c)
|
||||
q = r;
|
||||
else
|
||||
- return wws[r];
|
||||
+ {
|
||||
+ p = r;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
- return wws[p];
|
||||
+ return (wws[p] >= 0 ? wws[p] : /* FIXME */2);
|
||||
}
|
Loading…
Reference in a new issue