summaryrefslogtreecommitdiffstats
path: root/debian/patches/65-wcwidth.patch
blob: e8a118ea62d7d075bd068e459268a0037704a37c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Description: Use wcwdith instead of a hardcoded list of wide characters
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1027733;filename=screen.wcwidth.v2.patch;msg=80
Author: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-By: Axel Beckert <abe@debian.org>
Bug-Debian: https://bugs.debian.org/1027733
Forwarded: no
 (It is currently unclear if this patch is suitable for upstream usage.)

--- screen-4.9.0.orig/encoding.c
+++ screen-4.9.0/encoding.c
@@ -22,6 +22,7 @@
  */
 
 #include <sys/types.h>
+#include <wchar.h>
 
 #include "config.h"
 #include "screen.h"
@@ -1145,127 +1146,10 @@ int c;
     {0xF0000, 0xFFFFD},
     {0x100000, 0x10FFFD},
   };
-  /* A sorted list of intervals of double width characters generated by
-   * https://github.com/GNOME/glib/blob/glib-2-50/glib/gen-unicode-tables.pl */
-  static const struct interval wide[] = {
-    {0x1100, 0x115F},
-    {0x231A, 0x231B},
-    {0x2329, 0x232A},
-    {0x23E9, 0x23EC},
-    {0x23F0, 0x23F0},
-    {0x23F3, 0x23F3},
-    {0x25FD, 0x25FE},
-    {0x2614, 0x2615},
-    {0x2648, 0x2653},
-    {0x267F, 0x267F},
-    {0x2693, 0x2693},
-    {0x26A1, 0x26A1},
-    {0x26AA, 0x26AB},
-    {0x26BD, 0x26BE},
-    {0x26C4, 0x26C5},
-    {0x26CE, 0x26CE},
-    {0x26D4, 0x26D4},
-    {0x26EA, 0x26EA},
-    {0x26F2, 0x26F3},
-    {0x26F5, 0x26F5},
-    {0x26FA, 0x26FA},
-    {0x26FD, 0x26FD},
-    {0x2705, 0x2705},
-    {0x270A, 0x270B},
-    {0x2728, 0x2728},
-    {0x274C, 0x274C},
-    {0x274E, 0x274E},
-    {0x2753, 0x2755},
-    {0x2757, 0x2757},
-    {0x2795, 0x2797},
-    {0x27B0, 0x27B0},
-    {0x27BF, 0x27BF},
-    {0x2B1B, 0x2B1C},
-    {0x2B50, 0x2B50},
-    {0x2B55, 0x2B55},
-    {0x2E80, 0x2E99},
-    {0x2E9B, 0x2EF3},
-    {0x2F00, 0x2FD5},
-    {0x2FF0, 0x2FFB},
-    {0x3000, 0x303E},
-    {0x3041, 0x3096},
-    {0x3099, 0x30FF},
-    {0x3105, 0x312F},
-    {0x3131, 0x318E},
-    {0x3190, 0x31BA},
-    {0x31C0, 0x31E3},
-    {0x31F0, 0x321E},
-    {0x3220, 0x3247},
-    {0x3250, 0x4DBF},
-    {0x4E00, 0xA48C},
-    {0xA490, 0xA4C6},
-    {0xA960, 0xA97C},
-    {0xAC00, 0xD7A3},
-    {0xF900, 0xFAFF},
-    {0xFE10, 0xFE19},
-    {0xFE30, 0xFE52},
-    {0xFE54, 0xFE66},
-    {0xFE68, 0xFE6B},
-    {0xFF01, 0xFF60},
-    {0xFFE0, 0xFFE6},
-    {0x16FE0, 0x16FE3},
-    {0x17000, 0x187F7},
-    {0x18800, 0x18AF2},
-    {0x1B000, 0x1B11E},
-    {0x1B150, 0x1B152},
-    {0x1B164, 0x1B167},
-    {0x1B170, 0x1B2FB},
-    {0x1F004, 0x1F004},
-    {0x1F0CF, 0x1F0CF},
-    {0x1F18E, 0x1F18E},
-    {0x1F191, 0x1F19A},
-    {0x1F200, 0x1F202},
-    {0x1F210, 0x1F23B},
-    {0x1F240, 0x1F248},
-    {0x1F250, 0x1F251},
-    {0x1F260, 0x1F265},
-    {0x1F300, 0x1F320},
-    {0x1F32D, 0x1F335},
-    {0x1F337, 0x1F37C},
-    {0x1F37E, 0x1F393},
-    {0x1F3A0, 0x1F3CA},
-    {0x1F3CF, 0x1F3D3},
-    {0x1F3E0, 0x1F3F0},
-    {0x1F3F4, 0x1F3F4},
-    {0x1F3F8, 0x1F43E},
-    {0x1F440, 0x1F440},
-    {0x1F442, 0x1F4FC},
-    {0x1F4FF, 0x1F53D},
-    {0x1F54B, 0x1F54E},
-    {0x1F550, 0x1F567},
-    {0x1F57A, 0x1F57A},
-    {0x1F595, 0x1F596},
-    {0x1F5A4, 0x1F5A4},
-    {0x1F5FB, 0x1F64F},
-    {0x1F680, 0x1F6C5},
-    {0x1F6CC, 0x1F6CC},
-    {0x1F6D0, 0x1F6D2},
-    {0x1F6D5, 0x1F6D5},
-    {0x1F6EB, 0x1F6EC},
-    {0x1F6F4, 0x1F6FA},
-    {0x1F7E0, 0x1F7EB},
-    {0x1F90D, 0x1F971},
-    {0x1F973, 0x1F976},
-    {0x1F97A, 0x1F9A2},
-    {0x1F9A5, 0x1F9AA},
-    {0x1F9AE, 0x1F9CA},
-    {0x1F9CD, 0x1F9FF},
-    {0x1FA70, 0x1FA73},
-    {0x1FA78, 0x1FA7A},
-    {0x1FA80, 0x1FA82},
-    {0x1FA90, 0x1FA95},
-    {0x20000, 0x2FFFD},
-    {0x30000, 0x3FFFD},
-  };
 
   if (c >= 0xdf00 && c <= 0xdfff)
     return 1;			/* dw combining sequence */
-  return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) ||
+  return ((wcwidth(c) == 2) ||
           (cjkwidth &&
            bisearch(c, ambiguous,
 	            sizeof(ambiguous) / sizeof(struct interval) - 1)));