summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/reline/unicode.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/reline/unicode.rb b/lib/reline/unicode.rb
index d482997bab..5fcb8be7b3 100644
--- a/lib/reline/unicode.rb
+++ b/lib/reline/unicode.rb
@@ -95,6 +95,12 @@ class Reline::Unicode
/x
def self.get_mbchar_width(mbchar)
+ ord = mbchar.ord
+ if (0x00 <= ord and ord <= 0x1F)
+ return 2
+ elsif (0x20 <= ord and ord <= 0x7E)
+ return 1
+ end
m = mbchar.encode(Encoding::UTF_8).match(MBCharWidthRE)
case
when m[:width_2_1], m[:width_2_2] then 2