summaryrefslogtreecommitdiff
path: root/lib/reline/unicode.rb
diff options
context:
space:
mode:
authoraycabta <[email protected]>2021-02-15 00:27:51 +0900
committeraycabta <[email protected]>2021-02-21 06:41:03 +0900
commitdc9e33016c289f54407239b58e3e4669fdd442ad (patch)
tree70409407c32c607497459c65fd0db31bb062f226 /lib/reline/unicode.rb
parentb88be1009435ff10c582c727f71995f9c78f2885 (diff)
[ruby/reline] Return 1 when char width not found
This fixes ruby/reline#261. https://github.com/ruby/reline/commit/3cf1213014
Diffstat (limited to 'lib/reline/unicode.rb')
-rw-r--r--lib/reline/unicode.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/reline/unicode.rb b/lib/reline/unicode.rb
index 9b5ddc4622..7dbe8a12a5 100644
--- a/lib/reline/unicode.rb
+++ b/lib/reline/unicode.rb
@@ -108,6 +108,7 @@ class Reline::Unicode
end
m = mbchar.encode(Encoding::UTF_8).match(MBCharWidthRE)
case
+ when m.nil? then 1 # TODO should be U+FFFD � REPLACEMENT CHARACTER
when m[:width_2_1], m[:width_2_2] then 2
when m[:width_3] then 3
when m[:width_0] then 0