wcwidth 0.0.1 → 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wcwidth.rb +4 -2
- metadata +1 -1
data/lib/wcwidth.rb
CHANGED
@@ -112,13 +112,15 @@ protected
|
|
112
112
|
|
113
113
|
def mk_wcswidth
|
114
114
|
ws = self.each_char.map(&:width)
|
115
|
-
return -1 unless ws.
|
115
|
+
return -1 unless ws.all?{|x|x>=0}
|
116
116
|
ws.inject(:+)
|
117
117
|
end
|
118
118
|
|
119
119
|
public
|
120
120
|
def width
|
121
|
-
if self.size ==
|
121
|
+
if self.size == 0
|
122
|
+
0
|
123
|
+
elsif self.size == 1
|
122
124
|
self.mk_wcwidth
|
123
125
|
else
|
124
126
|
self.mk_wcswidth
|