1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Add comments about optimizing chars in ASCII range of UTF-8

https://github.com/ruby/reline/commit/3c13d93486
This commit is contained in:
aycabta 2021-09-06 05:19:50 +09:00 committed by git
parent f831ecd8d5
commit 1fe604a675

View file

@ -101,9 +101,9 @@ class Reline::Unicode
def self.get_mbchar_width(mbchar) def self.get_mbchar_width(mbchar)
ord = mbchar.ord ord = mbchar.ord
if (0x00 <= ord and ord <= 0x1F) if (0x00 <= ord and ord <= 0x1F) # in EscapedPairs
return 2 return 2
elsif (0x20 <= ord and ord <= 0x7E) elsif (0x20 <= ord and ord <= 0x7E) # printable ASCII chars
return 1 return 1
end end
m = mbchar.encode(Encoding::UTF_8).match(MBCharWidthRE) m = mbchar.encode(Encoding::UTF_8).match(MBCharWidthRE)