claude-statusline 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.bundle.js +9 -10
- package/dist/index.bundle.js.map +7 -0
- package/dist/index.js +71 -44
- package/dist/index.js.map +1 -1
- package/dist/metafile.json +479 -0
- package/dist/metafile.prod.json +6 -6
- package/dist/ui/width.d.ts +5 -0
- package/dist/ui/width.js +48 -0
- package/dist/ui/width.js.map +1 -1
- package/package.json +14 -14
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
{
|
|
2
|
+
"inputs": {
|
|
3
|
+
"src/core/config.ts": {
|
|
4
|
+
"bytes": 6754,
|
|
5
|
+
"imports": [
|
|
6
|
+
{
|
|
7
|
+
"path": "zod",
|
|
8
|
+
"kind": "import-statement",
|
|
9
|
+
"external": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "fs",
|
|
13
|
+
"kind": "import-statement",
|
|
14
|
+
"external": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "os",
|
|
18
|
+
"kind": "import-statement",
|
|
19
|
+
"external": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "path",
|
|
23
|
+
"kind": "import-statement",
|
|
24
|
+
"external": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "yaml",
|
|
28
|
+
"kind": "import-statement",
|
|
29
|
+
"external": true
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"format": "esm"
|
|
33
|
+
},
|
|
34
|
+
"src/core/security.ts": {
|
|
35
|
+
"bytes": 4599,
|
|
36
|
+
"imports": [
|
|
37
|
+
{
|
|
38
|
+
"path": "./config.js",
|
|
39
|
+
"kind": "import-statement",
|
|
40
|
+
"external": true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"path": "fs/promises",
|
|
44
|
+
"kind": "dynamic-import",
|
|
45
|
+
"external": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "fs",
|
|
49
|
+
"kind": "dynamic-import",
|
|
50
|
+
"external": true
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"format": "esm"
|
|
54
|
+
},
|
|
55
|
+
"src/core/cache.ts": {
|
|
56
|
+
"bytes": 7063,
|
|
57
|
+
"imports": [
|
|
58
|
+
{
|
|
59
|
+
"path": "fs/promises",
|
|
60
|
+
"kind": "import-statement",
|
|
61
|
+
"external": true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"path": "fs",
|
|
65
|
+
"kind": "import-statement",
|
|
66
|
+
"external": true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "path",
|
|
70
|
+
"kind": "import-statement",
|
|
71
|
+
"external": true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "./config.js",
|
|
75
|
+
"kind": "import-statement",
|
|
76
|
+
"external": true
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"path": "fs/promises",
|
|
80
|
+
"kind": "dynamic-import",
|
|
81
|
+
"external": true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "fs/promises",
|
|
85
|
+
"kind": "dynamic-import",
|
|
86
|
+
"external": true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"path": "fs/promises",
|
|
90
|
+
"kind": "dynamic-import",
|
|
91
|
+
"external": true
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"path": "child_process",
|
|
95
|
+
"kind": "dynamic-import",
|
|
96
|
+
"external": true
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"path": "util",
|
|
100
|
+
"kind": "dynamic-import",
|
|
101
|
+
"external": true
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"format": "esm"
|
|
105
|
+
},
|
|
106
|
+
"src/git/native.ts": {
|
|
107
|
+
"bytes": 3861,
|
|
108
|
+
"imports": [
|
|
109
|
+
{
|
|
110
|
+
"path": "child_process",
|
|
111
|
+
"kind": "import-statement",
|
|
112
|
+
"external": true
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"format": "esm"
|
|
116
|
+
},
|
|
117
|
+
"src/git/status.ts": {
|
|
118
|
+
"bytes": 8767,
|
|
119
|
+
"imports": [
|
|
120
|
+
{
|
|
121
|
+
"path": "../core/config.js",
|
|
122
|
+
"kind": "import-statement",
|
|
123
|
+
"external": true
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"path": "src/core/cache.ts",
|
|
127
|
+
"kind": "import-statement",
|
|
128
|
+
"original": "../core/cache.js"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"path": "src/git/native.ts",
|
|
132
|
+
"kind": "import-statement",
|
|
133
|
+
"original": "./native.js"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"format": "esm"
|
|
137
|
+
},
|
|
138
|
+
"src/ui/symbols.ts": {
|
|
139
|
+
"bytes": 10486,
|
|
140
|
+
"imports": [
|
|
141
|
+
{
|
|
142
|
+
"path": "../core/config.js",
|
|
143
|
+
"kind": "import-statement",
|
|
144
|
+
"external": true
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"path": "child_process",
|
|
148
|
+
"kind": "dynamic-import",
|
|
149
|
+
"external": true
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"path": "util",
|
|
153
|
+
"kind": "dynamic-import",
|
|
154
|
+
"external": true
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"path": "fs/promises",
|
|
158
|
+
"kind": "dynamic-import",
|
|
159
|
+
"external": true
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"path": "os",
|
|
163
|
+
"kind": "dynamic-import",
|
|
164
|
+
"external": true
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"path": "child_process",
|
|
168
|
+
"kind": "dynamic-import",
|
|
169
|
+
"external": true
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"path": "util",
|
|
173
|
+
"kind": "dynamic-import",
|
|
174
|
+
"external": true
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"format": "esm"
|
|
178
|
+
},
|
|
179
|
+
"src/ui/width.ts": {
|
|
180
|
+
"bytes": 11061,
|
|
181
|
+
"imports": [
|
|
182
|
+
{
|
|
183
|
+
"path": "../core/config.js",
|
|
184
|
+
"kind": "import-statement",
|
|
185
|
+
"external": true
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"path": "child_process",
|
|
189
|
+
"kind": "dynamic-import",
|
|
190
|
+
"external": true
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"path": "util",
|
|
194
|
+
"kind": "dynamic-import",
|
|
195
|
+
"external": true
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"path": "child_process",
|
|
199
|
+
"kind": "dynamic-import",
|
|
200
|
+
"external": true
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"path": "util",
|
|
204
|
+
"kind": "dynamic-import",
|
|
205
|
+
"external": true
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"format": "esm"
|
|
209
|
+
},
|
|
210
|
+
"src/env/context.ts": {
|
|
211
|
+
"bytes": 9791,
|
|
212
|
+
"imports": [
|
|
213
|
+
{
|
|
214
|
+
"path": "../core/config.js",
|
|
215
|
+
"kind": "import-statement",
|
|
216
|
+
"external": true
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"path": "src/core/cache.ts",
|
|
220
|
+
"kind": "import-statement",
|
|
221
|
+
"original": "../core/cache.js"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"path": "../ui/symbols.js",
|
|
225
|
+
"kind": "import-statement",
|
|
226
|
+
"external": true
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"path": "child_process",
|
|
230
|
+
"kind": "dynamic-import",
|
|
231
|
+
"external": true
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"path": "util",
|
|
235
|
+
"kind": "dynamic-import",
|
|
236
|
+
"external": true
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
"format": "esm"
|
|
240
|
+
},
|
|
241
|
+
"src/index.ts": {
|
|
242
|
+
"bytes": 16968,
|
|
243
|
+
"imports": [
|
|
244
|
+
{
|
|
245
|
+
"path": "fs",
|
|
246
|
+
"kind": "import-statement",
|
|
247
|
+
"external": true
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"path": "src/core/config.ts",
|
|
251
|
+
"kind": "import-statement",
|
|
252
|
+
"original": "./core/config.js"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"path": "src/core/security.ts",
|
|
256
|
+
"kind": "import-statement",
|
|
257
|
+
"original": "./core/security.js"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"path": "src/core/cache.ts",
|
|
261
|
+
"kind": "import-statement",
|
|
262
|
+
"original": "./core/cache.js"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"path": "src/git/status.ts",
|
|
266
|
+
"kind": "import-statement",
|
|
267
|
+
"original": "./git/status.js"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"path": "src/ui/symbols.ts",
|
|
271
|
+
"kind": "import-statement",
|
|
272
|
+
"original": "./ui/symbols.js"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"path": "src/ui/width.ts",
|
|
276
|
+
"kind": "import-statement",
|
|
277
|
+
"original": "./ui/width.js"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"path": "src/env/context.ts",
|
|
281
|
+
"kind": "import-statement",
|
|
282
|
+
"original": "./env/context.js"
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
"format": "esm"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"outputs": {
|
|
289
|
+
"dist/index.bundle.js.map": {
|
|
290
|
+
"imports": [],
|
|
291
|
+
"exports": [],
|
|
292
|
+
"inputs": {},
|
|
293
|
+
"bytes": 118861
|
|
294
|
+
},
|
|
295
|
+
"dist/index.bundle.js": {
|
|
296
|
+
"imports": [
|
|
297
|
+
{
|
|
298
|
+
"path": "fs",
|
|
299
|
+
"kind": "import-statement",
|
|
300
|
+
"external": true
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"path": "zod",
|
|
304
|
+
"kind": "import-statement",
|
|
305
|
+
"external": true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"path": "fs",
|
|
309
|
+
"kind": "import-statement",
|
|
310
|
+
"external": true
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"path": "os",
|
|
314
|
+
"kind": "import-statement",
|
|
315
|
+
"external": true
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"path": "path",
|
|
319
|
+
"kind": "import-statement",
|
|
320
|
+
"external": true
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"path": "yaml",
|
|
324
|
+
"kind": "import-statement",
|
|
325
|
+
"external": true
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"path": "fs/promises",
|
|
329
|
+
"kind": "dynamic-import",
|
|
330
|
+
"external": true
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"path": "fs",
|
|
334
|
+
"kind": "dynamic-import",
|
|
335
|
+
"external": true
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"path": "fs/promises",
|
|
339
|
+
"kind": "import-statement",
|
|
340
|
+
"external": true
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"path": "fs",
|
|
344
|
+
"kind": "import-statement",
|
|
345
|
+
"external": true
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"path": "path",
|
|
349
|
+
"kind": "import-statement",
|
|
350
|
+
"external": true
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"path": "fs/promises",
|
|
354
|
+
"kind": "dynamic-import",
|
|
355
|
+
"external": true
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"path": "fs/promises",
|
|
359
|
+
"kind": "dynamic-import",
|
|
360
|
+
"external": true
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"path": "fs/promises",
|
|
364
|
+
"kind": "dynamic-import",
|
|
365
|
+
"external": true
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"path": "child_process",
|
|
369
|
+
"kind": "dynamic-import",
|
|
370
|
+
"external": true
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"path": "util",
|
|
374
|
+
"kind": "dynamic-import",
|
|
375
|
+
"external": true
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"path": "child_process",
|
|
379
|
+
"kind": "import-statement",
|
|
380
|
+
"external": true
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"path": "child_process",
|
|
384
|
+
"kind": "dynamic-import",
|
|
385
|
+
"external": true
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"path": "util",
|
|
389
|
+
"kind": "dynamic-import",
|
|
390
|
+
"external": true
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"path": "fs/promises",
|
|
394
|
+
"kind": "dynamic-import",
|
|
395
|
+
"external": true
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"path": "os",
|
|
399
|
+
"kind": "dynamic-import",
|
|
400
|
+
"external": true
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"path": "child_process",
|
|
404
|
+
"kind": "dynamic-import",
|
|
405
|
+
"external": true
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"path": "util",
|
|
409
|
+
"kind": "dynamic-import",
|
|
410
|
+
"external": true
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"path": "child_process",
|
|
414
|
+
"kind": "dynamic-import",
|
|
415
|
+
"external": true
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"path": "util",
|
|
419
|
+
"kind": "dynamic-import",
|
|
420
|
+
"external": true
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"path": "child_process",
|
|
424
|
+
"kind": "dynamic-import",
|
|
425
|
+
"external": true
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"path": "util",
|
|
429
|
+
"kind": "dynamic-import",
|
|
430
|
+
"external": true
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"path": "child_process",
|
|
434
|
+
"kind": "dynamic-import",
|
|
435
|
+
"external": true
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"path": "util",
|
|
439
|
+
"kind": "dynamic-import",
|
|
440
|
+
"external": true
|
|
441
|
+
}
|
|
442
|
+
],
|
|
443
|
+
"exports": [
|
|
444
|
+
"main"
|
|
445
|
+
],
|
|
446
|
+
"entryPoint": "src/index.ts",
|
|
447
|
+
"inputs": {
|
|
448
|
+
"src/index.ts": {
|
|
449
|
+
"bytesInOutput": 9921
|
|
450
|
+
},
|
|
451
|
+
"src/core/config.ts": {
|
|
452
|
+
"bytesInOutput": 4415
|
|
453
|
+
},
|
|
454
|
+
"src/core/security.ts": {
|
|
455
|
+
"bytesInOutput": 2344
|
|
456
|
+
},
|
|
457
|
+
"src/core/cache.ts": {
|
|
458
|
+
"bytesInOutput": 5638
|
|
459
|
+
},
|
|
460
|
+
"src/git/native.ts": {
|
|
461
|
+
"bytesInOutput": 2808
|
|
462
|
+
},
|
|
463
|
+
"src/git/status.ts": {
|
|
464
|
+
"bytesInOutput": 6430
|
|
465
|
+
},
|
|
466
|
+
"src/ui/symbols.ts": {
|
|
467
|
+
"bytesInOutput": 7286
|
|
468
|
+
},
|
|
469
|
+
"src/ui/width.ts": {
|
|
470
|
+
"bytesInOutput": 6321
|
|
471
|
+
},
|
|
472
|
+
"src/env/context.ts": {
|
|
473
|
+
"bytesInOutput": 7285
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
"bytes": 52741
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
package/dist/metafile.prod.json
CHANGED
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"format": "esm"
|
|
178
178
|
},
|
|
179
179
|
"src/ui/width.ts": {
|
|
180
|
-
"bytes":
|
|
180
|
+
"bytes": 11061,
|
|
181
181
|
"imports": [
|
|
182
182
|
{
|
|
183
183
|
"path": "../core/config.js",
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
"format": "esm"
|
|
240
240
|
},
|
|
241
241
|
"src/index.ts": {
|
|
242
|
-
"bytes":
|
|
242
|
+
"bytes": 16968,
|
|
243
243
|
"imports": [
|
|
244
244
|
{
|
|
245
245
|
"path": "fs",
|
|
@@ -440,10 +440,10 @@
|
|
|
440
440
|
"entryPoint": "src/index.ts",
|
|
441
441
|
"inputs": {
|
|
442
442
|
"src/index.ts": {
|
|
443
|
-
"bytesInOutput":
|
|
443
|
+
"bytesInOutput": 3563
|
|
444
444
|
},
|
|
445
445
|
"src/core/config.ts": {
|
|
446
|
-
"bytesInOutput":
|
|
446
|
+
"bytesInOutput": 2741
|
|
447
447
|
},
|
|
448
448
|
"src/core/security.ts": {
|
|
449
449
|
"bytesInOutput": 1027
|
|
@@ -461,13 +461,13 @@
|
|
|
461
461
|
"bytesInOutput": 3618
|
|
462
462
|
},
|
|
463
463
|
"src/ui/width.ts": {
|
|
464
|
-
"bytesInOutput":
|
|
464
|
+
"bytesInOutput": 2274
|
|
465
465
|
},
|
|
466
466
|
"src/env/context.ts": {
|
|
467
467
|
"bytesInOutput": 3027
|
|
468
468
|
}
|
|
469
469
|
},
|
|
470
|
-
"bytes":
|
|
470
|
+
"bytes": 22022
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
}
|
package/dist/ui/width.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export declare function truncateText(text: string, maxLength: number): string;
|
|
|
23
23
|
* Smart truncation with branch prioritization (matches bash implementation)
|
|
24
24
|
*/
|
|
25
25
|
export declare function smartTruncate(project: string, gitInfo: string, maxLen: number, _config: Config): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get the display width of a string, accounting for wide characters (CJK, emoji, Nerd Font icons)
|
|
28
|
+
* Uses wcwidth-style logic where wide characters = 2 columns, narrow = 1 column
|
|
29
|
+
*/
|
|
30
|
+
export declare function getStringDisplayWidth(str: string): number;
|
|
26
31
|
/**
|
|
27
32
|
* Soft wrapping function (experimental)
|
|
28
33
|
*/
|
package/dist/ui/width.js
CHANGED
|
@@ -202,6 +202,54 @@ export function smartTruncate(project, gitInfo, maxLen, _config) {
|
|
|
202
202
|
// Step 4: Basic fallback
|
|
203
203
|
return `${project.substring(0, maxLen)}..`;
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Get the display width of a string, accounting for wide characters (CJK, emoji, Nerd Font icons)
|
|
207
|
+
* Uses wcwidth-style logic where wide characters = 2 columns, narrow = 1 column
|
|
208
|
+
*/
|
|
209
|
+
export function getStringDisplayWidth(str) {
|
|
210
|
+
let width = 0;
|
|
211
|
+
for (const char of str) {
|
|
212
|
+
const code = char.codePointAt(0) ?? 0;
|
|
213
|
+
// Wide character ranges (CJK, emoji, Nerd Font icons, etc.)
|
|
214
|
+
// CJK Unified Ideographs
|
|
215
|
+
if (code >= 0x1100 && ((code >= 0x1100 && code <= 0x115F) || // Hangul Jamo
|
|
216
|
+
(code >= 0x2E80 && code <= 0xA4CF) || // CJK和各种符号
|
|
217
|
+
(code >= 0xAC00 && code <= 0xD7A3) || // Hangul Syllables
|
|
218
|
+
(code >= 0xF900 && code <= 0xFAFF) || // CJK Compatibility Ideographs
|
|
219
|
+
(code >= 0xFE10 && code <= 0xFE19) || // Vertical forms
|
|
220
|
+
(code >= 0xFE30 && code <= 0xFE6F) || // CJK Compatibility Forms
|
|
221
|
+
(code >= 0xFF00 && code <= 0xFF60) || // Fullwidth Forms
|
|
222
|
+
(code >= 0xFFE0 && code <= 0xFFE6) ||
|
|
223
|
+
(code >= 0x20000 && code <= 0x2FFFD) ||
|
|
224
|
+
(code >= 0x30000 && code <= 0x3FFFD))) {
|
|
225
|
+
width += 2;
|
|
226
|
+
}
|
|
227
|
+
// Emoji and various symbols (including Nerd Font icons in Private Use Area)
|
|
228
|
+
else if ((code >= 0x1F300 && code <= 0x1F9FF) || // Emoji
|
|
229
|
+
(code >= 0x2600 && code <= 0x27BF) || // Miscellaneous symbols
|
|
230
|
+
(code >= 0xFE00 && code <= 0xFE0F) || // Variation Selectors
|
|
231
|
+
(code >= 0x1F000 && code <= 0x1F02F) || // Mahjong tiles
|
|
232
|
+
(code >= 0xE000 && code <= 0xF8FF) || // Private Use Area (Nerd Font icons)
|
|
233
|
+
(code >= 0xF0000 && code <= 0xFFFFD) || // Supplementary Private Use Area-A
|
|
234
|
+
(code >= 0x100000 && code <= 0x10FFFD) // Supplementary Private Use Area-B
|
|
235
|
+
) {
|
|
236
|
+
width += 2;
|
|
237
|
+
}
|
|
238
|
+
// Combining characters (zero width)
|
|
239
|
+
else if ((code >= 0x0300 && code <= 0x036F) || // Combining diacritical marks
|
|
240
|
+
(code >= 0x1DC0 && code <= 0x1DFF) || // Combining diacritical marks extended
|
|
241
|
+
(code >= 0x20D0 && code <= 0x20FF) || // Combining marks for symbols
|
|
242
|
+
(code >= 0xFE20 && code <= 0xFE2F) // Combining half marks
|
|
243
|
+
) {
|
|
244
|
+
// Zero width, don't increment
|
|
245
|
+
}
|
|
246
|
+
// Normal ASCII and narrow characters
|
|
247
|
+
else {
|
|
248
|
+
width += 1;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return width;
|
|
252
|
+
}
|
|
205
253
|
/**
|
|
206
254
|
* Soft wrapping function (experimental)
|
|
207
255
|
*/
|