Commit 36eb8f2
committed
Summary of Changes
New Files
include/hbgtwide.h – public header for wide-character width calculation
Renamed / Refactored
src/codepage/mk_wcwidth.c → src/codepage/hb_wcwidth.c (re-implemented with Harbour types, no macros)
Updated Makefiles & References
src/codepage/Makefile – source list changed from mk_wcwidth.c to hb_wcwidth.c
src/rtl/hbgtcore.c – include path switched to hbgtwide.h
src/rtl/Makefile – adjusted -I path (../codepage → ../include)
Review Comments Addressed
Source-level types instead of macros
Uses Harbour types: HB_WCHAR32, HB_SIZE, HB_WCHAR.
Header placed under include/ and renamed to hbgtwide.h
Public include now matches project convention.
HB_ namespace for all exported symbols
mk_wcwidth() → hb_wcwidth()
Helper tables/functions already prefixed (hb_wcswidth, hb_wcswidth_cjk).
All widths returned as literal 0 / 1 / 2; no #define used.
Character tables remain inside CODEPAGE modules
combining[] and wide[] static tables live in src/codepage/hb_wcwidth.c.
Deferred for Future Work
Emoji support
Static Unicode TR-11 rules are used; emoji widths can vary by font—dynamic hooks can be added later.
Dynamic width tables
Maintainer noted potential need for runtime-replaceable tables; current code keeps static arrays but leaves the function-pointer path open.
Full glyph knowledge
As reviewer stated, “perfect timing” for complete glyph handling is not now; this patch provides the minimal, working foundation.
Merge branch 'fix-utf8-cursor-col' of github.com:woodhead2019/harbour into fix-utf8-cursor-col
Signed-off-by: woodhead2019 <woodhead2019@users.noreply.github.com>File tree
4 files changed
+31
-73
lines changed- include
- src
- codepage
- rtl
4 files changed
+31
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
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 | | - | |
| 22 | + | |
50 | 23 | | |
51 | 24 | | |
52 | | - | |
53 | | - | |
54 | 25 | | |
55 | 26 | | |
56 | 27 | | |
57 | | - | |
| 28 | + | |
58 | 29 | | |
59 | 30 | | |
60 | 31 | | |
| |||
67 | 38 | | |
68 | 39 | | |
69 | 40 | | |
70 | | - | |
| 41 | + | |
71 | 42 | | |
72 | 43 | | |
73 | | - | |
74 | | - | |
75 | 44 | | |
76 | 45 | | |
77 | 46 | | |
78 | | - | |
| 47 | + | |
79 | 48 | | |
80 | 49 | | |
81 | 50 | | |
| |||
85 | 54 | | |
86 | 55 | | |
87 | 56 | | |
88 | | - | |
| 57 | + | |
89 | 58 | | |
90 | 59 | | |
91 | | - | |
92 | | - | |
93 | 60 | | |
94 | 61 | | |
95 | 62 | | |
96 | | - | |
| 63 | + | |
97 | 64 | | |
98 | 65 | | |
99 | 66 | | |
| |||
104 | 71 | | |
105 | 72 | | |
106 | 73 | | |
107 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
108 | 77 | | |
109 | | - | |
| 78 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 12 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | | - | |
19 | 16 | | |
20 | 17 | | |
21 | | - | |
22 | | - | |
| 18 | + | |
23 | 19 | | |
| 20 | + | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
31 | | - | |
| 28 | + | |
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
| |||
113 | 110 | | |
114 | 111 | | |
115 | 112 | | |
116 | | - | |
117 | | - | |
118 | 113 | | |
119 | 114 | | |
120 | 115 | | |
121 | | - | |
| 116 | + | |
122 | 117 | | |
123 | 118 | | |
124 | 119 | | |
| |||
131 | 126 | | |
132 | 127 | | |
133 | 128 | | |
134 | | - | |
| 129 | + | |
135 | 130 | | |
136 | 131 | | |
137 | 132 | | |
| |||
144 | 139 | | |
145 | 140 | | |
146 | 141 | | |
147 | | - | |
148 | | - | |
149 | 142 | | |
150 | 143 | | |
151 | 144 | | |
| |||
154 | 147 | | |
155 | 148 | | |
156 | 149 | | |
157 | | - | |
158 | | - | |
159 | 150 | | |
160 | 151 | | |
161 | 152 | | |
162 | | - | |
| 153 | + | |
163 | 154 | | |
164 | 155 | | |
165 | 156 | | |
| |||
169 | 160 | | |
170 | 161 | | |
171 | 162 | | |
172 | | - | |
| 163 | + | |
173 | 164 | | |
174 | 165 | | |
175 | 166 | | |
176 | 167 | | |
177 | 168 | | |
178 | | - | |
| 169 | + | |
179 | 170 | | |
180 | 171 | | |
181 | 172 | | |
| |||
188 | 179 | | |
189 | 180 | | |
190 | 181 | | |
191 | | - | |
192 | | - | |
193 | 182 | | |
194 | 183 | | |
195 | 184 | | |
196 | | - | |
| 185 | + | |
197 | 186 | | |
198 | 187 | | |
199 | 188 | | |
| |||
204 | 193 | | |
205 | 194 | | |
206 | 195 | | |
207 | | - | |
| 196 | + | |
208 | 197 | | |
209 | 198 | | |
210 | 199 | | |
211 | 200 | | |
212 | 201 | | |
213 | | - | |
| 202 | + | |
214 | 203 | | |
215 | 204 | | |
216 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
0 commit comments