-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathwcwidth.fsx
333 lines (318 loc) · 9.35 KB
/
wcwidth.fsx
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
#r "nuget: FSharp.Control.Reactive"
#r "nuget: FSharp.Data"
#r "nuget: System.Reactive.Linq"
#r "nuget: Avalonia, 0.10.0-preview6"
#r "nuget: Avalonia.Desktop, 0.10.0-preview6"
#r "nuget: Avalonia.ReactiveUI, 0.10.0-preview6"
#r "nuget: Avalonia.Skia, 0.10.0-preview6"
#load "common.fs"
#load "getopt.fs"
#load "config.fs"
#load "log.fs"
#load "def.fs"
#load "wcwidth.fs"
(* a few symbols from jdhao, wbthomason
01 ●
02 ✔
03 🗙 <--- a surrogate pair
04 ➤
05 *
06 +
07 ~
08 ⚠
09 ☰ (U+2630)
10 Ꞩ (U+A7A8)
11 Ɇ (U+0246)
12 ⎇ (U+2387)
13 ☲ (U+2632)
*)
open FVim.def
open FVim.wcwidth
let parse = (|Rune|_|) >> Option.get
let codepoint (x: Rune) = sprintf "U+%X" x.Codepoint
let rune_03 = "🗙" |> parse
let rune_04 = "➤" |> parse
let rune_10 = "Ꞩ" |> parse
let rune_12 = "⎇" |> parse
wswidth rune_03 // narrow
wswidth rune_04 // narrow
wswidth rune_10 // narrow
wswidth rune_12 // narrow
codepoint rune_03
codepoint rune_04
codepoint rune_10
codepoint rune_12
// the Miscellaneous Technical plane...
let rune_2300 = "⌀" |> parse
let rune_2301 = "⌁" |> parse
let rune_2302 = "⌂" |> parse
let rune_2303 = "⌃" |> parse
let rune_2304 = "⌄" |> parse
let rune_2305 = "⌅" |> parse
let rune_2306 = "⌆" |> parse
let rune_2307 = "⌇" |> parse
let rune_2308 = "⌈" |> parse
let rune_2309 = "⌉" |> parse
let rune_230A = "⌊" |> parse
let rune_230B = "⌋" |> parse
let rune_230C = "⌌" |> parse
let rune_230D = "⌍" |> parse
let rune_230E = "⌎" |> parse
let rune_230F = "⌏" |> parse
let rune_2310 = "⌐" |> parse
let rune_2311 = "⌑" |> parse
let rune_2312 = "⌒" |> parse
let rune_2313 = "⌓" |> parse
let rune_2314 = "⌔" |> parse
let rune_2315 = "⌕" |> parse
let rune_2316 = "⌖" |> parse
let rune_2317 = "⌗" |> parse
let rune_2318 = "⌘" |> parse
let rune_2319 = "⌙" |> parse
let rune_231A = "⌚" |> parse
let rune_231B = "⌛" |> parse
let rune_231C = "⌜" |> parse
let rune_231D = "⌝" |> parse
let rune_231E = "⌞" |> parse
let rune_231F = "⌟" |> parse
let rune_2320 = "⌠" |> parse
let rune_2321 = "⌡" |> parse
let rune_2322 = "⌢" |> parse
let rune_2323 = "⌣" |> parse
let rune_2324 = "⌤" |> parse
let rune_2325 = "⌥" |> parse
let rune_2326 = "⌦" |> parse
let rune_2327 = "⌧" |> parse
let rune_2328 = "⌨" |> parse
let rune_2329 = "〈" |> parse
let rune_232A = "〉" |> parse
let rune_232B = "⌫" |> parse
let rune_232C = "⌬" |> parse
let rune_232D = "⌭" |> parse
let rune_232E = "⌮" |> parse
let rune_232F = "⌯" |> parse
let rune_2330 = "⌰" |> parse
let rune_2331 = "⌱" |> parse
let rune_2332 = "⌲" |> parse
let rune_2333 = "⌳" |> parse
let rune_2334 = "⌴" |> parse
let rune_2335 = "⌵" |> parse
let rune_2336 = "⌶" |> parse
let rune_2337 = "⌷" |> parse
let rune_2338 = "⌸" |> parse
let rune_2339 = "⌹" |> parse
let rune_233A = "⌺" |> parse
let rune_233B = "⌻" |> parse
let rune_233C = "⌼" |> parse
let rune_233D = "⌽" |> parse
let rune_233E = "⌾" |> parse
let rune_233F = "⌿" |> parse
let rune_2340 = "⍀" |> parse
let rune_2341 = "⍁" |> parse
let rune_2342 = "⍂" |> parse
let rune_2343 = "⍃" |> parse
let rune_2344 = "⍄" |> parse
let rune_2345 = "⍅" |> parse
let rune_2346 = "⍆" |> parse
let rune_2347 = "⍇" |> parse
let rune_2348 = "⍈" |> parse
let rune_2349 = "⍉" |> parse
let rune_234A = "⍊" |> parse
let rune_234B = "⍋" |> parse
let rune_234C = "⍌" |> parse
let rune_234D = "⍍" |> parse
let rune_234E = "⍎" |> parse
let rune_234F = "⍏" |> parse
let rune_2350 = "⍐" |> parse
let rune_2351 = "⍑" |> parse
let rune_2352 = "⍒" |> parse
let rune_2353 = "⍓" |> parse
let rune_2354 = "⍔" |> parse
let rune_2355 = "⍕" |> parse
let rune_2356 = "⍖" |> parse
let rune_2357 = "⍗" |> parse
let rune_2358 = "⍘" |> parse
let rune_2359 = "⍙" |> parse
let rune_235A = "⍚" |> parse
let rune_235B = "⍛" |> parse
let rune_235C = "⍜" |> parse
let rune_235D = "⍝" |> parse
let rune_235E = "⍞" |> parse
let rune_235F = "⍟" |> parse
let rune_2360 = "⍠" |> parse
let rune_2361 = "⍡" |> parse
let rune_2362 = "⍢" |> parse
let rune_2363 = "⍣" |> parse
let rune_2364 = "⍤" |> parse
let rune_2365 = "⍥" |> parse
let rune_2366 = "⍦" |> parse
let rune_2367 = "⍧" |> parse
let rune_2368 = "⍨" |> parse
let rune_2369 = "⍩" |> parse
let rune_236A = "⍪" |> parse
let rune_236B = "⍫" |> parse
let rune_236C = "⍬" |> parse
let rune_236D = "⍭" |> parse
let rune_236E = "⍮" |> parse
let rune_236F = "⍯" |> parse
let rune_2370 = "⍰" |> parse
let rune_2371 = "⍱" |> parse
let rune_2372 = "⍲" |> parse
let rune_2373 = "⍳" |> parse
let rune_2374 = "⍴" |> parse
let rune_2375 = "⍵" |> parse
let rune_2376 = "⍶" |> parse
let rune_2377 = "⍷" |> parse
let rune_2378 = "⍸" |> parse
let rune_2379 = "⍹" |> parse
let rune_237A = "⍺" |> parse
let rune_237B = "⍻" |> parse
let rune_237C = "⍼" |> parse
let rune_237D = "⍽" |> parse
let rune_237E = "⍾" |> parse
let rune_237F = "⍿" |> parse
let rune_2380 = "⎀" |> parse
let rune_2381 = "⎁" |> parse
let rune_2382 = "⎂" |> parse
let rune_2383 = "⎃" |> parse
let rune_2384 = "⎄" |> parse
let rune_2385 = "⎅" |> parse
let rune_2386 = "⎆" |> parse
let rune_2387 = "⎇" |> parse
let rune_2388 = "⎈" |> parse
let rune_2389 = "⎉" |> parse
let rune_238A = "⎊" |> parse
let rune_238B = "⎋" |> parse
let rune_238C = "⎌" |> parse
let rune_238D = "⎍" |> parse
let rune_238E = "⎎" |> parse
let rune_238F = "⎏" |> parse
let rune_2390 = "⎐" |> parse
let rune_2391 = "⎑" |> parse
let rune_2392 = "⎒" |> parse
let rune_2393 = "⎓" |> parse
let rune_2394 = "⎔" |> parse
let rune_2395 = "⎕" |> parse
let rune_2396 = "⎖" |> parse
let rune_2397 = "⎗" |> parse
let rune_2398 = "⎘" |> parse
let rune_2399 = "⎙" |> parse
let rune_239A = "⎚" |> parse
let rune_239B = "⎛" |> parse
let rune_239C = "⎜" |> parse
let rune_239D = "⎝" |> parse
let rune_239E = "⎞" |> parse
let rune_239F = "⎟" |> parse
let rune_23A0 = "⎠" |> parse
let rune_23A1 = "⎡" |> parse
let rune_23A2 = "⎢" |> parse
let rune_23A3 = "⎣" |> parse
let rune_23A4 = "⎤" |> parse
let rune_23A5 = "⎥" |> parse
let rune_23A6 = "⎦" |> parse
let rune_23A7 = "⎧" |> parse
let rune_23A8 = "⎨" |> parse
let rune_23A9 = "⎩" |> parse
let rune_23AA = "⎪" |> parse
let rune_23AB = "⎫" |> parse
let rune_23AC = "⎬" |> parse
let rune_23AD = "⎭" |> parse
let rune_23AE = "⎮" |> parse
let rune_23AF = "⎯" |> parse
let rune_23B0 = "⎰" |> parse
let rune_23B1 = "⎱" |> parse
let rune_23B2 = "⎲" |> parse
let rune_23B3 = "⎳" |> parse
let rune_23B4 = "⎴" |> parse
let rune_23B5 = "⎵" |> parse
let rune_23B6 = "⎶" |> parse
let rune_23B7 = "⎷" |> parse
let rune_23B8 = "⎸" |> parse
let rune_23B9 = "⎹" |> parse
let rune_23BA = "⎺" |> parse
let rune_23BB = "⎻" |> parse
let rune_23BC = "⎼" |> parse
let rune_23BD = "⎽" |> parse
let rune_23BE = "⎾" |> parse
let rune_23BF = "⎿" |> parse
let rune_23C0 = "⏀" |> parse
let rune_23C1 = "⏁" |> parse
let rune_23C2 = "⏂" |> parse
let rune_23C3 = "⏃" |> parse
let rune_23C4 = "⏄" |> parse
let rune_23C5 = "⏅" |> parse
let rune_23C6 = "⏆" |> parse
let rune_23C7 = "⏇" |> parse
let rune_23C8 = "⏈" |> parse
let rune_23C9 = "⏉" |> parse
let rune_23CA = "⏊" |> parse
let rune_23CB = "⏋" |> parse
let rune_23CC = "⏌" |> parse
let rune_23CD = "⏍" |> parse
let rune_23CE = "⏎" |> parse
let rune_23CF = "⏏" |> parse
let rune_23D0 = "⏐" |> parse
let rune_23D1 = "⏑" |> parse
let rune_23D2 = "⏒" |> parse
let rune_23D3 = "⏓" |> parse
let rune_23D4 = "⏔" |> parse
let rune_23D5 = "⏕" |> parse
let rune_23D6 = "⏖" |> parse
let rune_23D7 = "⏗" |> parse
let rune_23D8 = "⏘" |> parse
let rune_23D9 = "⏙" |> parse
let rune_23DA = "⏚" |> parse
let rune_23DB = "⏛" |> parse
let rune_23DC = "⏜" |> parse
let rune_23DD = "⏝" |> parse
let rune_23DE = "⏞" |> parse
let rune_23DF = "⏟" |> parse
let rune_23E0 = "⏠" |> parse
let rune_23E1 = "⏡" |> parse
let rune_23E2 = "⏢" |> parse
let rune_23E3 = "⏣" |> parse
let rune_23E4 = "⏤" |> parse
let rune_23E5 = "⏥" |> parse
let rune_23E6 = "⏦" |> parse
let rune_23E7 = "⏧" |> parse
let rune_23E8 = "⏨" |> parse
let rune_23E9 = "⏩" |> parse
let rune_23EA = "⏪" |> parse
let rune_23EB = "⏫" |> parse
let rune_23EC = "⏬" |> parse
let rune_23ED = "⏭" |> parse
let rune_23EE = "⏮" |> parse
let rune_23EF = "⏯" |> parse
let rune_23F0 = "⏰" |> parse
let rune_23F1 = "⏱" |> parse
let rune_23F2 = "⏲" |> parse
let rune_23F3 = "⏳" |> parse
let rune_23F4 = "⏴" |> parse
let rune_23F5 = "⏵" |> parse
let rune_23F6 = "⏶" |> parse
let rune_23F7 = "⏷" |> parse
let rune_23F8 = "⏸" |> parse
let rune_23F9 = "⏹" |> parse
let rune_23FA = "⏺" |> parse
// The Optical Character Recognition plane.. lol
let rune_2440 = "⑀" |> parse
let rune_2441 = "⑁" |> parse
let rune_2442 = "⑂" |> parse
let rune_2443 = "⑃" |> parse
let rune_2444 = "⑄" |> parse
let rune_2445 = "⑅" |> parse
let rune_2446 = "⑆" |> parse
let rune_2447 = "⑇" |> parse
let rune_2448 = "⑈" |> parse
let rune_2449 = "⑉" |> parse
let rune_244A = "⑊" |> parse
// Now, some avalonia tests
open Avalonia.Media
open Avalonia.Visuals
open Avalonia.Platform
open Avalonia.Media.TextFormatting
Avalonia.Skia.SkiaPlatform.Initialize();;
let iosevka = Typeface("Iosevka Slab")
let iosevka_glyph = iosevka.GlyphTypeface
iosevka_glyph.GetGlyph(rune_03.Codepoint) // 0 for the block symbol
iosevka_glyph.GetGlyph(rune_244A.Codepoint)