lib/Terminal/WCWidth.pm

filter: Statementstmt 76.5% 49 / 64 Branchbran 66.6% 24 / 36 Conditioncond 59.2% 32 / 54 MC/DCmcdc 20.0% 5 / 25 Subroutinesub 90.0% 9 / 10 Podpod 100% 2 / 2 totaltotal 63.3% 121 / 191 CC 38 SCAR 36.7
CC
38
Cov
68%
wcwidth
56.8
wcswidth
30.0
__ANON__
6.0
CRAP 39.2
« lib/Termbox/PP.pm ↑ Summary script/build_wcwidth_tables.pl »
1 # ------------------------------------------------------------------------
2 #
3 # WCWidth - determine columns needed for a wide character
4 #
5 # Code based on Terminal::WCWidth (a Raku port), 2026
6 #
7 # Copyright (c) 2007 Markus Kuhn (Unicode 5.0)
8 # 2014 Jeff Quast <contact@jeffquast.com>
9 # 2015-2017 +merlan #flirora <http://flirora.xyz/>
10 # 2020,2024 Raku Community
11 #
12 # ------------------------------------------------------------------------
13 # Author: 2024-2026 J. Schneider
14 # ------------------------------------------------------------------------
15
16 package Terminal::WCWidth;
17
18 # ------------------------------------------------------------------------
19 # Boilerplate ------------------------------------------------------------
20 # ------------------------------------------------------------------------
21
22 39 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 39 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 39 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
25
26 # version '...'
27 39 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 39 our $version = version->declare('v0.1.5');
29 39 our $VERSION = version->declare('v0.6.3');
30
31 # authority '...'
32 39 our $authority = 'github:raku-community-modules';
33 39 our $AUTHORITY = 'github:brickpool';
34
35 # ------------------------------------------------------------------------
36 # Imports ----------------------------------------------------------------
37 # ------------------------------------------------------------------------
38
39 39 ▶use Unicode::Normalize qw( NFC );
Subroutine BEGIN: called CC=1 SCAR=0.0
40 39 ▶use Terminal::WCWidth::Tables;
Subroutine BEGIN: called CC=1 SCAR=0.0
41
42 # ------------------------------------------------------------------------
43 # Exports ----------------------------------------------------------------
44 # ------------------------------------------------------------------------
45
46 =head1 EXPORTS
47
48 Nothing per default, but can export the following per request:
49
50 :all
51 wcwidth
52 wcswidth
53
54 =cut
55
56 39 ▶use Exporter qw( import );
Subroutine BEGIN: called CC=1 SCAR=0.0
57
58 39 our @EXPORT_OK = qw(
59 wcwidth
60 wcswidth
61 );
62
63 39 our %EXPORT_TAGS = (
64 all => \@EXPORT_OK,
65 );
66
67 # ------------------------------------------------------------------------
68 # Variables --------------------------------------------------------------
69 # ------------------------------------------------------------------------
70
71 39 our $CACHE;
72
73 # ------------------------------------------------------------------------
74 # Functions --------------------------------------------------------------
75 # ------------------------------------------------------------------------
76
77 # Auxiliary function for binary search in interval table
78 79 ▶my $bisearch = sub { # $result ($ucs, \@table)
Subroutine __ANON__: called CC=6 SCAR=17.9
79 79 my ($ucs, $table) = @_;
80 79 my $lower = 0;
81 79 my $upper = scalar(@$table) - 1;
82 79 ▶ return 0 if $ucs < $table->[0][0] || $ucs > $table->[$upper][1];
Branch: 1 branch
BranchTrueFalseTotal
if $ucs < $table->[0][0] or $ucs > $table->[$upper][1] 43 36 79
Condition66%2/3
$ucs < $table->[0][0] or $ucs > $table->[$upper][1]
l!l&&r!l&&!r
43036
MC/DC50%1/2
$ucs < $table->[0][0] or $ucs > $table->[$upper][1]
$ucs < $table->[0][0] $ucs > $table->[$upper][1]
Truth table66%2/3
A or B
A= $ucs < $table->[0][0]B= $ucs > $table->[$upper][1]
ABresult
1X1
011
000
83 36 ▶ while ($upper >= $lower) {
Branch: 1 branch
BranchTrueFalseTotal
if ($upper >= $lower) 287 21 308
84 287 my $mid = ($lower + $upper) >> 1;
85 287 ▶ if ($ucs > $table->[$mid][1]) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ucs > $table->[$mid][1]) { } 133 154 287
elsif ($ucs < $table->[$mid][0]) { } 139 15 154
86 133 $lower = $mid + 1;
87 } elsif ($ucs < $table->[$mid][0]) {
88 139 $upper = $mid - 1;
89 } else {
90 15 return 1;
91 }
92 }
93 21 return 0;
94 39 };
95
96 44 ▶sub wcwidth { # $result ($ucs)
Subroutine wcwidth: called CC=29 SCAR=40.4
Pod documented
97 44 my ($ucs) = @_;
98
99 44 ▶ return -1
Branch: 1 branch
BranchTrueFalseTotal
if not defined $ucs or ref $ucs 0 44 44
Condition33%1/3
not defined $ucs or ref $ucs
l!l&&r!l&&!r
0044
MC/DC0%0/2
not defined $ucs or ref $ucs
not defined $ucs ref $ucs
Truth table33%1/3
not(A) or B
A= not defined $ucsB= ref $ucs
ABresult
1X1
011
000
100 if !defined $ucs || ref $ucs;
101
102 44 ▶ return -1
Branch: 1 branch
BranchTrueFalseTotal
if $ucs < 0 or $ucs > 1114111 or $ucs >= 55296 and $ucs <= 57343 0 44 44
Condition44%4/9
$ucs < 0 or $ucs > 1114111 or $ucs >= 55296 and $ucs <= 57343
l!l&&r!l&&!r
0044
$ucs < 0 or $ucs > 1114111
l!l&&r!l&&!r
0044
$ucs >= 55296 and $ucs <= 57343
!ll&&!rl&&r
4310
MC/DC0%0/4
$ucs < 0 or $ucs > 1114111 or $ucs >= 55296 and $ucs <= 57343
$ucs < 0 $ucs > 1114111 $ucs >= 55296 $ucs <= 57343
Truth table40%2/5
A or B or C and D
A= $ucs < 0B= $ucs > 1114111C= $ucs >= 55296D= $ucs <= 57343
ABCDresult
1XXX1
01XX1
00111
000X0
00100
103 if ($ucs < 0 || $ucs > 0x10ffff)
104 || ($ucs >= 0xD800 && $ucs <= 0xDFFF);
105
106 return $CACHE->{$ucs}
107 44 ▶ if defined $CACHE && exists $CACHE->{$ucs};
Branch: 1 branch
BranchTrueFalseTotal
if defined $Terminal::WCWidth::CACHE and exists $Terminal::WCWidth::CACHE->{$ucs} 0 44 44
Condition33%1/3
defined $Terminal::WCWidth::CACHE and exists $Terminal::WCWidth::CACHE->{$ucs}
!ll&&!rl&&r
4400
MC/DC0%0/2
defined $Terminal::WCWidth::CACHE and exists $Terminal::WCWidth::CACHE->{$ucs}
defined $Terminal::WCWidth::CACHE exists $Terminal::WCWidth::CACHE->{$ucs}
Truth table33%1/3
A and B
A= defined $Terminal::WCWidth::CACHEB= exists $Terminal::WCWidth::CACHE->{$ucs}
ABresult
0X0
100
111
108
109 44 ▶ return (defined $CACHE ? ($CACHE->{$ucs} = 0) : 0)
Branch: 2 branches
BranchTrueFalseTotal
if $ucs == 0 or $ucs == 847 or $ucs == 8232 or $ucs == 8233 or 8203 <= $ucs and $ucs <= 8207 or 8234 <= $ucs and $ucs <= 8238 or 8288 <= $ucs and $ucs <= 8291 2 42 44
defined $Terminal::WCWidth::CACHE ? : 0 2 2
Condition74%20/27
$ucs == 0 or $ucs == 847 or $ucs == 8232 or $ucs == 8233 or 8203 <= $ucs and $ucs <= 8207 or 8234 <= $ucs and $ucs <= 8238 or 8288 <= $ucs and $ucs <= 8291
l!l&&r!l&&!r
2042
$ucs == 0 or $ucs == 847 or $ucs == 8232 or $ucs == 8233 or 8203 <= $ucs and $ucs <= 8207 or 8234 <= $ucs and $ucs <= 8238
l!l&&r!l&&!r
2042
$ucs == 0 or $ucs == 847 or $ucs == 8232 or $ucs == 8233 or 8203 <= $ucs and $ucs <= 8207
l!l&&r!l&&!r
1142
$ucs == 0 or $ucs == 847 or $ucs == 8232 or $ucs == 8233
l!l&&r!l&&!r
1043
$ucs == 0 or $ucs == 847 or $ucs == 8232
l!l&&r!l&&!r
1043
$ucs == 0 or $ucs == 847
l!l&&r!l&&!r
1043
8203 <= $ucs and $ucs <= 8207
!ll&&!rl&&r
30121
8234 <= $ucs and $ucs <= 8238
!ll&&!rl&&r
30120
8288 <= $ucs and $ucs <= 8291
!ll&&!rl&&r
30120
MC/DC30%3/10
$ucs == 0 or $ucs == 847 or $ucs == 8232 or $ucs == 8233 or 8203 <= $ucs and $ucs <= 8207 or 8234 <= $ucs and $ucs <= 8238 or 8288 <= $ucs and $ucs <= 8291
$ucs == 0 $ucs == 847 $ucs == 8232 $ucs == 8233 8203 <= $ucs $ucs <= 8207 8234 <= $ucs $ucs <= 8238 8288 <= $ucs $ucs <= 8291
Truth table21%4/19
A or B or C or D or E and F or G and H or I and J
A= $ucs == 0B= $ucs == 847C= $ucs == 8232D= $ucs == 8233E= 8203 <= $ucsF= $ucs <= 8207G= 8234 <= $ucsH= $ucs <= 8238I= 8288 <= $ucsJ= $ucs <= 8291
ABCDEFGHIJresult
1XXXXXXXXX1
01XXXXXXXX1
001XXXXXXX1
0001XXXXXX1
000011XXXX1
00000X11XX1
00001011XX1
00000X0X111
00000X10111
0000100X111
00001010111
00000X0X0X0
00000X0X100
00000X100X0
00000X10100
0000100X0X0
0000100X100
000010100X0
00001010100
110 if $ucs == 0
111 || $ucs == 0x034f
112 || $ucs == 0x2028
113 || $ucs == 0x2029
114 || (0x200b <= $ucs && $ucs <= 0x200f)
115 || (0x202a <= $ucs && $ucs <= 0x202e)
116 || (0x2060 <= $ucs && $ucs <= 0x2063);
117
118 42 ▶ return (defined $CACHE ? ($CACHE->{$ucs} = -1) : -1)
Branch: 2 branches
BranchTrueFalseTotal
if $ucs < 32 or 127 <= $ucs and $ucs < 160 1 41 42
defined $Terminal::WCWidth::CACHE ? : 0 1 1
Condition66%4/6
$ucs < 32 or 127 <= $ucs and $ucs < 160
l!l&&r!l&&!r
1041
127 <= $ucs and $ucs < 160
!ll&&!rl&&r
21200
MC/DC33%1/3
$ucs < 32 or 127 <= $ucs and $ucs < 160
$ucs < 32 127 <= $ucs $ucs < 160
Truth table75%3/4
A or B and C
A= $ucs < 32B= 127 <= $ucsC= $ucs < 160
ABCresult
1XX1
0111
00X0
0100
119 if $ucs < 32 || (0x07f <= $ucs && $ucs < 0x0a0);
120
121 41 ▶ return (defined $CACHE ? ($CACHE->{$ucs} = 0) : 0)
Branch: 2 branches
BranchTrueFalseTotal
if &$bisearch($ucs, [[768,879],[1155,1159],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[1759,1764],[1767,1768],[1770,1773],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2199,2207],[2250,2273],[2275,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2901,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3132,3132],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3457,3457],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3790],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4957,4959],[5906,5908],[5938,5939],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6159,6159],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6845],[6846,6846],[6847,6877],[6880,6891],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7679],[8400,8412],[8413,8416],[8417,8417],[8418,8420],[8421,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42607],[42608,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43052,43052],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[68969,68973],[69291,69292],[69370,69375],[69446,69456],[69506,69509],[69633,69633],[69688,69702],[69744,69744],[69747,69748],[69759,69761],[69811,69814],[69817,69818],[69826,69826],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70095,70095],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70209,70209],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70587,70592],[70606,70606],[70608,70608],[70610,70610],[70625,70626],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71453],[71455,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[71995,71996],[71998,71998],[72003,72003],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72544,72544],[72546,72548],[72550,72550],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[73472,73473],[73526,73530],[73536,73536],[73538,73538],[73562,73562],[78912,78912],[78919,78933],[90398,90409],[90413,90415],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[94180,94180],[113821,113822],[118528,118573],[118576,118598],[119143,119145],[119163,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123023,123023],[123184,123190],[123566,123566],[123628,123631],[124140,124143],[124398,124399],[124643,124643],[124646,124646],[124654,124655],[124661,124661],[125136,125142],[125252,125258],[917760,917999]]) 3 38 41
defined $Terminal::WCWidth::CACHE ? : 0 3 3
122 if $bisearch->($ucs, ZERO_WIDTH);
123
124 38 ▶ return (defined $CACHE ? ($CACHE->{$ucs} = 2) : 2)
Branch: 2 branches
BranchTrueFalseTotal
if &$bisearch($ucs, [[4352,4447],[8986,8987],[9001,9001],[9002,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9776,9783],[9800,9811],[9855,9855],[9866,9871],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12287],[12288,12288],[12289,12291],[12292,12292],[12293,12293],[12294,12294],[12295,12295],[12296,12296],[12297,12297],[12298,12298],[12299,12299],[12300,12300],[12301,12301],[12302,12302],[12303,12303],[12304,12304],[12305,12305],[12306,12307],[12308,12308],[12309,12309],[12310,12310],[12311,12311],[12312,12312],[12313,12313],[12314,12314],[12315,12315],[12316,12316],[12317,12317],[12318,12319],[12320,12320],[12321,12329],[12330,12333],[12334,12335],[12336,12336],[12337,12341],[12342,12343],[12344,12346],[12347,12347],[12348,12348],[12349,12349],[12350,12350],[12353,12438],[12441,12442],[12443,12444],[12445,12446],[12447,12447],[12448,12448],[12449,12538],[12539,12539],[12540,12542],[12543,12543],[12549,12591],[12593,12686],[12688,12689],[12690,12693],[12694,12703],[12704,12735],[12736,12773],[12783,12783],[12784,12799],[12800,12830],[12832,12841],[12842,12871],[12880,12880],[12881,12895],[12896,12927],[12928,12937],[12938,12976],[12977,12991],[12992,13055],[13056,13311],[13312,19903],[19904,19967],[19968,40959],[40960,40980],[40981,40981],[40982,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64109],[64110,64111],[64112,64217],[64218,64255],[65040,65046],[65047,65047],[65048,65048],[65049,65049],[65072,65072],[65073,65074],[65075,65076],[65077,65077],[65078,65078],[65079,65079],[65080,65080],[65081,65081],[65082,65082],[65083,65083],[65084,65084],[65085,65085],[65086,65086],[65087,65087],[65088,65088],[65089,65089],[65090,65090],[65091,65091],[65092,65092],[65093,65094],[65095,65095],[65096,65096],[65097,65100],[65101,65103],[65104,65106],[65108,65111],[65112,65112],[65113,65113],[65114,65114],[65115,65115],[65116,65116],[65117,65117],[65118,65118],[65119,65121],[65122,65122],[65123,65123],[65124,65126],[65128,65128],[65129,65129],[65130,65131],[65281,65283],[65284,65284],[65285,65287],[65288,65288],[65289,65289],[65290,65290],[65291,65291],[65292,65292],[65293,65293],[65294,65295],[65296,65305],[65306,65307],[65308,65310],[65311,65312],[65313,65338],[65339,65339],[65340,65340],[65341,65341],[65342,65342],[65343,65343],[65344,65344],[65345,65370],[65371,65371],[65372,65372],[65373,65373],[65374,65374],[65375,65375],[65376,65376],[65504,65505],[65506,65506],[65507,65507],[65508,65508],[65509,65510],[94176,94177],[94178,94178],[94179,94179],[94180,94180],[94192,94193],[94194,94195],[94196,94198],[94208,100351],[100352,101119],[101120,101589],[101631,101631],[101632,101662],[101760,101874],[110576,110579],[110581,110587],[110589,110590],[110592,110847],[110848,110882],[110898,110898],[110928,110930],[110933,110933],[110948,110951],[110960,111355],[119552,119638],[119648,119670],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,127994],[127995,127999],[128000,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128511],[128512,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128728],[128732,128735],[128747,128748],[128756,128764],[128992,129003],[129008,129008],[129292,129338],[129340,129349],[129351,129535],[129648,129660],[129664,129674],[129678,129734],[129736,129736],[129741,129756],[129759,129770],[129775,129784],[131072,173791],[173792,173823],[173824,178205],[178206,178207],[178208,183981],[183982,183983],[183984,191456],[191457,191471],[191472,192093],[192094,194559],[194560,195101],[195102,195103],[195104,196605],[196608,201546],[201547,201551],[201552,210041],[210042,262141]]) 12 26 38
defined $Terminal::WCWidth::CACHE ? : 0 12 12
125 if $bisearch->($ucs, WIDE_EASTASIAN);
126
127 26 ▶ return (defined $CACHE ? ($CACHE->{$ucs} = 1) : 1);
Branch: 1 branch
BranchTrueFalseTotal
defined $Terminal::WCWidth::CACHE ? : 0 26 26
128 }
129
130 0 ▶sub wcswidth { # $result ($str)
Subroutine wcswidth: not called CC=5 SCAR=34.0
Pod documented
131 0 my ($str) = @_;
132 0 $str = NFC($str);
133 0 my $res = 0;
134 0 my $prev_w = 0;
135 0 for (split //, $str) {
136 0 my $cp = ord($_);
137 0 ▶ if ($cp == 0xfe0f && $prev_w == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cp == 65039 and $prev_w == 1) 0 0 0
Condition0%0/3
$cp == 65039 and $prev_w == 1
!ll&&!rl&&r
000
MC/DC0%0/2
$cp == 65039 and $prev_w == 1
$cp == 65039 $prev_w == 1
Truth table0%0/3
A and B
A= $cp == 65039B= $prev_w == 1
ABresult
0X0
100
111
138 0 $res += 1;
139 0 $prev_w = 0;
140 0 next;
141 }
142 0 my $w = wcwidth($cp);
143 0 ▶ return -1 if $w < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $w < 0 0 0 0
144 0 $res += $w;
145 0 $prev_w = $w;
146 }
147 0 return $res;
148 }
149
150 39 1;
151
152 __END__
« lib/Termbox/PP.pm ↑ Summary script/build_wcwidth_tables.pl »