tangled
alpha
login
or
join now
eldridge.cam
/
paper-terminal
0
fork
atom
Print Markdown to a paper in your terminal
0
fork
atom
overview
issues
pulls
pipelines
Improve cjk width measurements more, in tables
eldridge.cam
3 years ago
76c19ee2
80adf035
+154
-166
5 changed files
expand all
collapse all
unified
split
Cargo.lock
Cargo.toml
src
main.rs
str_width.rs
table.rs
+125
-147
Cargo.lock
···
16
16
17
17
[[package]]
18
18
name = "aho-corasick"
19
19
-
version = "0.7.15"
19
19
+
version = "0.7.18"
20
20
source = "registry+https://github.com/rust-lang/crates.io-index"
21
21
-
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
21
21
+
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
22
22
dependencies = [
23
23
"memchr",
24
24
-
]
25
25
-
26
26
-
[[package]]
27
27
-
name = "ansi_term"
28
28
-
version = "0.11.0"
29
29
-
source = "registry+https://github.com/rust-lang/crates.io-index"
30
30
-
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
31
31
-
dependencies = [
32
32
-
"winapi",
33
24
]
34
25
35
26
[[package]]
···
54
45
55
46
[[package]]
56
47
name = "autocfg"
57
57
-
version = "1.0.1"
48
48
+
version = "1.1.0"
58
49
source = "registry+https://github.com/rust-lang/crates.io-index"
59
59
-
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
50
50
+
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
60
51
61
52
[[package]]
62
53
name = "bitflags"
63
63
-
version = "1.2.1"
54
54
+
version = "1.3.2"
64
55
source = "registry+https://github.com/rust-lang/crates.io-index"
65
65
-
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
56
56
+
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
66
57
67
58
[[package]]
68
59
name = "bytemuck"
69
69
-
version = "1.5.1"
60
60
+
version = "1.9.1"
70
61
source = "registry+https://github.com/rust-lang/crates.io-index"
71
71
-
checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58"
62
62
+
checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc"
72
63
73
64
[[package]]
74
65
name = "byteorder"
···
78
69
79
70
[[package]]
80
71
name = "cc"
81
81
-
version = "1.0.67"
72
72
+
version = "1.0.73"
82
73
source = "registry+https://github.com/rust-lang/crates.io-index"
83
83
-
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
74
74
+
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
84
75
85
76
[[package]]
86
77
name = "cfg-if"
···
102
93
103
94
[[package]]
104
95
name = "clap"
105
105
-
version = "2.33.3"
96
96
+
version = "2.34.0"
106
97
source = "registry+https://github.com/rust-lang/crates.io-index"
107
107
-
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
98
98
+
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
108
99
dependencies = [
109
109
-
"ansi_term 0.11.0",
100
100
+
"ansi_term",
110
101
"atty",
111
102
"bitflags",
112
103
"strsim",
···
138
129
139
130
[[package]]
140
131
name = "crc32fast"
141
141
-
version = "1.2.1"
132
132
+
version = "1.3.2"
142
133
source = "registry+https://github.com/rust-lang/crates.io-index"
143
143
-
checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
134
134
+
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
144
135
dependencies = [
145
136
"cfg-if",
146
137
]
147
138
148
139
[[package]]
149
140
name = "crossbeam-channel"
150
150
-
version = "0.5.0"
141
141
+
version = "0.5.5"
151
142
source = "registry+https://github.com/rust-lang/crates.io-index"
152
152
-
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
143
143
+
checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c"
153
144
dependencies = [
154
145
"cfg-if",
155
146
"crossbeam-utils",
···
168
159
169
160
[[package]]
170
161
name = "crossbeam-epoch"
171
171
-
version = "0.9.3"
162
162
+
version = "0.9.9"
172
163
source = "registry+https://github.com/rust-lang/crates.io-index"
173
173
-
checksum = "2584f639eb95fea8c798496315b297cf81b9b58b6d30ab066a75455333cf4b12"
164
164
+
checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d"
174
165
dependencies = [
166
166
+
"autocfg",
175
167
"cfg-if",
176
168
"crossbeam-utils",
177
177
-
"lazy_static",
178
169
"memoffset",
170
170
+
"once_cell",
179
171
"scopeguard",
180
172
]
181
173
182
174
[[package]]
183
175
name = "crossbeam-utils"
184
184
-
version = "0.8.8"
176
176
+
version = "0.8.10"
185
177
source = "registry+https://github.com/rust-lang/crates.io-index"
186
186
-
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
178
178
+
checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83"
187
179
dependencies = [
188
180
"cfg-if",
189
189
-
"lazy_static",
181
181
+
"once_cell",
190
182
]
191
183
192
184
[[package]]
···
234
226
235
227
[[package]]
236
228
name = "enquote"
237
237
-
version = "1.0.3"
229
229
+
version = "1.1.0"
238
230
source = "registry+https://github.com/rust-lang/crates.io-index"
239
239
-
checksum = "2ec878a5d2f3b6e9eaee72373dd23414cfc7d353104741471bec712ef241a66e"
231
231
+
checksum = "06c36cb11dbde389f4096111698d8b567c0720e3452fd5ac3e6b4e47e1939932"
232
232
+
dependencies = [
233
233
+
"thiserror",
234
234
+
]
240
235
241
236
[[package]]
242
237
name = "getopts"
···
249
244
250
245
[[package]]
251
246
name = "getrandom"
252
252
-
version = "0.2.2"
247
247
+
version = "0.2.7"
253
248
source = "registry+https://github.com/rust-lang/crates.io-index"
254
254
-
checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
249
249
+
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
255
250
dependencies = [
256
251
"cfg-if",
257
252
"libc",
···
260
255
261
256
[[package]]
262
257
name = "gif"
263
263
-
version = "0.11.2"
258
258
+
version = "0.11.3"
264
259
source = "registry+https://github.com/rust-lang/crates.io-index"
265
265
-
checksum = "5a668f699973d0f573d15749b7002a9ac9e1f9c6b220e7b165601334c173d8de"
260
260
+
checksum = "c3a7187e78088aead22ceedeee99779455b23fc231fe13ec443f99bb71694e5b"
266
261
dependencies = [
267
262
"color_quant",
268
263
"weezl",
···
270
265
271
266
[[package]]
272
267
name = "heck"
273
273
-
version = "0.3.2"
268
268
+
version = "0.3.3"
274
269
source = "registry+https://github.com/rust-lang/crates.io-index"
275
275
-
checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
270
270
+
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
276
271
dependencies = [
277
272
"unicode-segmentation",
278
273
]
279
274
280
275
[[package]]
281
276
name = "hermit-abi"
282
282
-
version = "0.1.18"
277
277
+
version = "0.1.19"
283
278
source = "registry+https://github.com/rust-lang/crates.io-index"
284
284
-
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
279
279
+
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
285
280
dependencies = [
286
281
"libc",
287
282
]
···
310
305
"scoped_threadpool",
311
306
"tiff",
312
307
]
313
313
-
314
314
-
[[package]]
315
315
-
name = "itoa"
316
316
-
version = "0.4.7"
317
317
-
source = "registry+https://github.com/rust-lang/crates.io-index"
318
318
-
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
319
308
320
309
[[package]]
321
310
name = "jpeg-decoder"
···
334
323
335
324
[[package]]
336
325
name = "libc"
337
337
-
version = "0.2.92"
326
326
+
version = "0.2.126"
338
327
source = "registry+https://github.com/rust-lang/crates.io-index"
339
339
-
checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714"
328
328
+
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
340
329
341
330
[[package]]
342
331
name = "memchr"
343
343
-
version = "2.3.4"
332
332
+
version = "2.5.0"
344
333
source = "registry+https://github.com/rust-lang/crates.io-index"
345
345
-
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
334
334
+
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
346
335
347
336
[[package]]
348
337
name = "memoffset"
349
349
-
version = "0.6.3"
338
338
+
version = "0.6.5"
350
339
source = "registry+https://github.com/rust-lang/crates.io-index"
351
351
-
checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d"
340
340
+
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
352
341
dependencies = [
353
342
"autocfg",
354
343
]
···
374
363
375
364
[[package]]
376
365
name = "num-integer"
377
377
-
version = "0.1.44"
366
366
+
version = "0.1.45"
378
367
source = "registry+https://github.com/rust-lang/crates.io-index"
379
379
-
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
368
368
+
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
380
369
dependencies = [
381
370
"autocfg",
382
371
"num-traits",
···
384
373
385
374
[[package]]
386
375
name = "num-iter"
387
387
-
version = "0.1.42"
376
376
+
version = "0.1.43"
388
377
source = "registry+https://github.com/rust-lang/crates.io-index"
389
389
-
checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
378
378
+
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
390
379
dependencies = [
391
380
"autocfg",
392
381
"num-integer",
···
406
395
407
396
[[package]]
408
397
name = "num-traits"
409
409
-
version = "0.2.14"
398
398
+
version = "0.2.15"
410
399
source = "registry+https://github.com/rust-lang/crates.io-index"
411
411
-
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
400
400
+
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
412
401
dependencies = [
413
402
"autocfg",
414
403
]
415
404
416
405
[[package]]
417
406
name = "num_cpus"
418
418
-
version = "1.13.0"
407
407
+
version = "1.13.1"
419
408
source = "registry+https://github.com/rust-lang/crates.io-index"
420
420
-
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
409
409
+
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
421
410
dependencies = [
422
411
"hermit-abi",
423
412
"libc",
424
413
]
414
414
+
415
415
+
[[package]]
416
416
+
name = "once_cell"
417
417
+
version = "1.12.0"
418
418
+
source = "registry+https://github.com/rust-lang/crates.io-index"
419
419
+
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
425
420
426
421
[[package]]
427
422
name = "paper-terminal"
428
423
version = "2.2.0"
429
424
dependencies = [
430
430
-
"ansi_term 0.12.1",
425
425
+
"ansi_term",
431
426
"cjk",
432
427
"console",
433
428
"directories-next",
···
477
472
478
473
[[package]]
479
474
name = "proc-macro2"
480
480
-
version = "1.0.26"
475
475
+
version = "1.0.40"
481
476
source = "registry+https://github.com/rust-lang/crates.io-index"
482
482
-
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
477
477
+
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
483
478
dependencies = [
484
484
-
"unicode-xid",
479
479
+
"unicode-ident",
485
480
]
486
481
487
482
[[package]]
···
498
493
499
494
[[package]]
500
495
name = "quote"
501
501
-
version = "1.0.9"
496
496
+
version = "1.0.20"
502
497
source = "registry+https://github.com/rust-lang/crates.io-index"
503
503
-
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
498
498
+
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
504
499
dependencies = [
505
500
"proc-macro2",
506
501
]
507
502
508
503
[[package]]
509
504
name = "rayon"
510
510
-
version = "1.5.0"
505
505
+
version = "1.5.3"
511
506
source = "registry+https://github.com/rust-lang/crates.io-index"
512
512
-
checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
507
507
+
checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d"
513
508
dependencies = [
514
509
"autocfg",
515
510
"crossbeam-deque",
···
519
514
520
515
[[package]]
521
516
name = "rayon-core"
522
522
-
version = "1.9.0"
517
517
+
version = "1.9.3"
523
518
source = "registry+https://github.com/rust-lang/crates.io-index"
524
524
-
checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
519
519
+
checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f"
525
520
dependencies = [
526
521
"crossbeam-channel",
527
522
"crossbeam-deque",
528
523
"crossbeam-utils",
529
529
-
"lazy_static",
530
524
"num_cpus",
531
525
]
532
526
533
527
[[package]]
534
528
name = "redox_syscall"
535
535
-
version = "0.2.5"
529
529
+
version = "0.2.13"
536
530
source = "registry+https://github.com/rust-lang/crates.io-index"
537
537
-
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
531
531
+
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
538
532
dependencies = [
539
533
"bitflags",
540
534
]
541
535
542
536
[[package]]
543
537
name = "redox_users"
544
544
-
version = "0.4.0"
538
538
+
version = "0.4.3"
545
539
source = "registry+https://github.com/rust-lang/crates.io-index"
546
546
-
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
540
540
+
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
547
541
dependencies = [
548
542
"getrandom",
549
543
"redox_syscall",
544
544
+
"thiserror",
550
545
]
551
546
552
547
[[package]]
553
548
name = "regex"
554
554
-
version = "1.4.5"
549
549
+
version = "1.5.6"
555
550
source = "registry+https://github.com/rust-lang/crates.io-index"
556
556
-
checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
551
551
+
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
557
552
dependencies = [
558
553
"aho-corasick",
559
554
"memchr",
···
562
557
563
558
[[package]]
564
559
name = "regex-syntax"
565
565
-
version = "0.6.23"
560
560
+
version = "0.6.26"
566
561
source = "registry+https://github.com/rust-lang/crates.io-index"
567
567
-
checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
568
568
-
569
569
-
[[package]]
570
570
-
name = "ryu"
571
571
-
version = "1.0.5"
572
572
-
source = "registry+https://github.com/rust-lang/crates.io-index"
573
573
-
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
562
562
+
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
574
563
575
564
[[package]]
576
565
name = "scoped_threadpool"
···
585
574
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
586
575
587
576
[[package]]
588
588
-
name = "serde"
589
589
-
version = "1.0.125"
590
590
-
source = "registry+https://github.com/rust-lang/crates.io-index"
591
591
-
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
592
592
-
593
593
-
[[package]]
594
594
-
name = "serde_derive"
595
595
-
version = "1.0.125"
596
596
-
source = "registry+https://github.com/rust-lang/crates.io-index"
597
597
-
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
598
598
-
dependencies = [
599
599
-
"proc-macro2",
600
600
-
"quote",
601
601
-
"syn",
602
602
-
]
603
603
-
604
604
-
[[package]]
605
605
-
name = "serde_json"
606
606
-
version = "1.0.64"
607
607
-
source = "registry+https://github.com/rust-lang/crates.io-index"
608
608
-
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
609
609
-
dependencies = [
610
610
-
"itoa",
611
611
-
"ryu",
612
612
-
"serde",
613
613
-
]
614
614
-
615
615
-
[[package]]
616
577
name = "strsim"
617
578
version = "0.8.0"
618
579
source = "registry+https://github.com/rust-lang/crates.io-index"
···
620
581
621
582
[[package]]
622
583
name = "structopt"
623
623
-
version = "0.3.21"
584
584
+
version = "0.3.26"
624
585
source = "registry+https://github.com/rust-lang/crates.io-index"
625
625
-
checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c"
586
586
+
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
626
587
dependencies = [
627
588
"clap",
628
589
"lazy_static",
···
631
592
632
593
[[package]]
633
594
name = "structopt-derive"
634
634
-
version = "0.4.14"
595
595
+
version = "0.4.18"
635
596
source = "registry+https://github.com/rust-lang/crates.io-index"
636
636
-
checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90"
597
597
+
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
637
598
dependencies = [
638
599
"heck",
639
600
"proc-macro-error",
···
644
605
645
606
[[package]]
646
607
name = "syn"
647
647
-
version = "1.0.68"
608
608
+
version = "1.0.98"
648
609
source = "registry+https://github.com/rust-lang/crates.io-index"
649
649
-
checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87"
610
610
+
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
650
611
dependencies = [
651
612
"proc-macro2",
652
613
"quote",
653
653
-
"unicode-xid",
614
614
+
"unicode-ident",
654
615
]
655
616
656
617
[[package]]
657
618
name = "syncat-stylesheet"
658
658
-
version = "2.2.0"
619
619
+
version = "2.2.1"
659
620
source = "registry+https://github.com/rust-lang/crates.io-index"
660
660
-
checksum = "d58d4411972200fcd5277e93f359573f19c3688ccf39073d5cc4ebdb46240ac0"
621
621
+
checksum = "2abdfdde201305d60c7f184dde404f6cae02390dda149567b7fca39fe76c21d4"
661
622
dependencies = [
662
662
-
"ansi_term 0.12.1",
623
623
+
"ansi_term",
663
624
"cc",
664
625
"enquote",
665
626
"hex",
···
669
630
670
631
[[package]]
671
632
name = "terminal_size"
672
672
-
version = "0.1.16"
633
633
+
version = "0.1.17"
673
634
source = "registry+https://github.com/rust-lang/crates.io-index"
674
674
-
checksum = "86ca8ced750734db02076f44132d802af0b33b09942331f4459dde8636fd2406"
635
635
+
checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
675
636
dependencies = [
676
637
"libc",
677
638
"winapi",
···
687
648
]
688
649
689
650
[[package]]
651
651
+
name = "thiserror"
652
652
+
version = "1.0.31"
653
653
+
source = "registry+https://github.com/rust-lang/crates.io-index"
654
654
+
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
655
655
+
dependencies = [
656
656
+
"thiserror-impl",
657
657
+
]
658
658
+
659
659
+
[[package]]
660
660
+
name = "thiserror-impl"
661
661
+
version = "1.0.31"
662
662
+
source = "registry+https://github.com/rust-lang/crates.io-index"
663
663
+
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
664
664
+
dependencies = [
665
665
+
"proc-macro2",
666
666
+
"quote",
667
667
+
"syn",
668
668
+
]
669
669
+
670
670
+
[[package]]
690
671
name = "tiff"
691
672
version = "0.6.1"
692
673
source = "registry+https://github.com/rust-lang/crates.io-index"
···
699
680
700
681
[[package]]
701
682
name = "tree-sitter"
702
702
-
version = "0.6.3"
683
683
+
version = "0.19.5"
703
684
source = "registry+https://github.com/rust-lang/crates.io-index"
704
704
-
checksum = "376e181cb69da67bad2d69806cf2500656fd68123c526a61e5cbbfc65110c5b0"
685
685
+
checksum = "ad726ec26496bf4c083fff0f43d4eb3a2ad1bba305323af5ff91383c0b6ecac0"
705
686
dependencies = [
706
687
"cc",
707
688
"regex",
708
708
-
"serde",
709
709
-
"serde_derive",
710
710
-
"serde_json",
711
689
]
712
690
713
691
[[package]]
···
726
704
checksum = "588aff0737b18e4172b3b827fac917e10b955df566a78f701d25cca354c65b73"
727
705
728
706
[[package]]
729
729
-
name = "unicode-segmentation"
730
730
-
version = "1.7.1"
707
707
+
name = "unicode-ident"
708
708
+
version = "1.0.1"
731
709
source = "registry+https://github.com/rust-lang/crates.io-index"
732
732
-
checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
710
710
+
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
733
711
734
712
[[package]]
735
735
-
name = "unicode-width"
736
736
-
version = "0.1.8"
713
713
+
name = "unicode-segmentation"
714
714
+
version = "1.9.0"
737
715
source = "registry+https://github.com/rust-lang/crates.io-index"
738
738
-
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
716
716
+
checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
739
717
740
718
[[package]]
741
741
-
name = "unicode-xid"
742
742
-
version = "0.2.1"
719
719
+
name = "unicode-width"
720
720
+
version = "0.1.9"
743
721
source = "registry+https://github.com/rust-lang/crates.io-index"
744
744
-
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
722
722
+
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
745
723
746
724
[[package]]
747
725
name = "vec_map"
···
751
729
752
730
[[package]]
753
731
name = "version_check"
754
754
-
version = "0.9.3"
732
732
+
version = "0.9.4"
755
733
source = "registry+https://github.com/rust-lang/crates.io-index"
756
756
-
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
734
734
+
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
757
735
758
736
[[package]]
759
737
name = "wasi"
760
760
-
version = "0.10.2+wasi-snapshot-preview1"
738
738
+
version = "0.11.0+wasi-snapshot-preview1"
761
739
source = "registry+https://github.com/rust-lang/crates.io-index"
762
762
-
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
740
740
+
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
763
741
764
742
[[package]]
765
743
name = "weezl"
766
766
-
version = "0.1.4"
744
744
+
version = "0.1.6"
767
745
source = "registry+https://github.com/rust-lang/crates.io-index"
768
768
-
checksum = "4a32b378380f4e9869b22f0b5177c68a5519f03b3454fde0b291455ddbae266c"
746
746
+
checksum = "9c97e489d8f836838d497091de568cf16b117486d529ec5579233521065bd5e4"
769
747
770
748
[[package]]
771
749
name = "widestring"
+1
-1
Cargo.toml
···
22
22
pulldown-cmark = "0.8"
23
23
ansi_term = "0.12"
24
24
image = "0.23"
25
25
-
console = "0.14"
25
25
+
console = { version = "0.14", features = ["unicode-width"] }
26
26
directories-next = "2.0"
27
27
syncat-stylesheet = { version = "2.1.4", features = ["ansi_term"] }
28
28
unicode-width = "0.1"
+2
-8
src/main.rs
···
8
8
use structopt::StructOpt;
9
9
use syncat_stylesheet::Stylesheet;
10
10
use terminal_size::{terminal_size, Width};
11
11
-
use unicode_width::UnicodeWidthChar;
12
11
13
12
mod dirs;
14
13
mod printer;
14
14
+
mod str_width;
15
15
mod table;
16
16
mod termpix;
17
17
mod words;
18
18
19
19
use printer::Printer;
20
20
+
use str_width::str_width;
20
21
use words::Words;
21
21
-
22
22
-
fn str_width(s: &str) -> usize {
23
23
-
strip_ansi_codes(s)
24
24
-
.chars()
25
25
-
.flat_map(UnicodeWidthChar::width_cjk)
26
26
-
.sum()
27
27
-
}
28
22
29
23
/// Prints papers in your terminal
30
24
#[derive(StructOpt, Debug)]
+15
src/str_width.rs
···
1
1
+
use console::strip_ansi_codes;
2
2
+
use unicode_width::UnicodeWidthChar;
3
3
+
4
4
+
pub fn str_width(s: &str) -> usize {
5
5
+
strip_ansi_codes(s)
6
6
+
.chars()
7
7
+
.flat_map(|ch| {
8
8
+
if cjk::is_cjk_codepoint(ch) {
9
9
+
UnicodeWidthChar::width_cjk(ch)
10
10
+
} else {
11
11
+
UnicodeWidthChar::width(ch)
12
12
+
}
13
13
+
})
14
14
+
.sum()
15
15
+
}
+11
-10
src/table.rs
···
1
1
+
use crate::str_width;
1
2
use crate::words::Words;
2
3
use ansi_term::Style;
3
3
-
use console::{measure_text_width, strip_ansi_codes};
4
4
+
use console::strip_ansi_codes;
4
5
use pulldown_cmark::Alignment;
5
6
use std::io::Write;
6
7
···
49
50
.iter()
50
51
.map(|title| {
51
52
Words::new(title)
52
52
-
.map(|word| word.trim().len())
53
53
+
.map(|word| str_width(word.trim()))
53
54
.max()
54
55
.unwrap_or(0)
55
56
})
···
61
62
row.iter()
62
63
.map(|cell| {
63
64
Words::new(cell)
64
64
-
.map(|word| word.trim().len())
65
65
+
.map(|word| str_width(word.trim()))
65
66
.max()
66
67
.unwrap_or(0)
67
68
})
68
69
.collect::<Vec<_>>()
69
70
})
70
70
-
.fold(title_longest_words.clone(), |mut chars, row| {
71
71
+
.fold(title_longest_words, |mut chars, row| {
71
72
for i in 0..row.len() {
72
73
chars[i] = usize::max(chars[i], row[i]);
73
74
}
···
76
77
77
78
let mut title_chars = titles
78
79
.iter()
79
79
-
.map(|title| title.lines().map(measure_text_width).max().unwrap_or(0))
80
80
+
.map(|title| title.lines().map(str_width).max().unwrap_or(0))
80
81
.collect::<Vec<_>>();
81
82
title_chars.resize(num_cols, 0);
82
83
let max_chars_per_col = rows
83
84
.iter()
84
85
.map(|row| {
85
86
row.iter()
86
86
-
.map(|cell| cell.lines().map(measure_text_width).max().unwrap_or(0))
87
87
+
.map(|cell| cell.lines().map(str_width).max().unwrap_or(0))
87
88
.collect::<Vec<_>>()
88
89
})
89
90
.fold(title_chars.clone(), |mut chars, row| {
···
159
160
loop {
160
161
match words.next() {
161
162
Some(next) => {
162
162
-
if measure_text_width(&line) + measure_text_width(&next) <= cols[i] {
163
163
+
if str_width(&line) + str_width(&next) <= cols[i] {
163
164
line += &next;
164
165
} else {
165
166
words.undo();
···
172
173
}
173
174
line = line.trim().to_string();
174
175
let padded = if alignment[i] == Alignment::Center {
175
175
-
format!(" {: ^width$} │", line, width = cols[i])
176
176
+
format!(" {: ^width$} │", line, width = cols[i] - (line.len().saturating_sub(str_width(&line))))
176
177
} else if alignment[i] == Alignment::Right {
177
177
-
format!(" {: >width$} │", line, width = cols[i])
178
178
+
format!(" {: >width$} │", line, width = cols[i] - (line.len().saturating_sub(str_width(&line))))
178
179
} else {
179
179
-
format!(" {: <width$} │", line, width = cols[i])
180
180
+
format!(" {: <width$} │", line, width = cols[i] - (line.len().saturating_sub(str_width(&line))))
180
181
};
181
182
write!(w, "{}", paper_style.paint(padded)).unwrap();
182
183
}