[前][次][番号順一覧][スレッド一覧]

ruby-changes:67612

From: aycabta <ko1@a...>
Date: Mon, 6 Sep 2021 05:22:45 +0900 (JST)
Subject: [ruby-changes:67612] 1fe604a675 (master): [ruby/reline] Add comments about optimizing chars in ASCII range of UTF-8

https://git.ruby-lang.org/ruby.git/commit/?id=1fe604a675

From 1fe604a67501d5f05694266d065833e3c150d79a Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Mon, 6 Sep 2021 05:19:50 +0900
Subject: [ruby/reline] Add comments about optimizing chars in ASCII range of
 UTF-8

https://github.com/ruby/reline/commit/3c13d93486
---
 lib/reline/unicode.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/reline/unicode.rb b/lib/reline/unicode.rb
index d111a84..a0fe074 100644
--- a/lib/reline/unicode.rb
+++ b/lib/reline/unicode.rb
@@ -101,9 +101,9 @@ class Reline::Unicode https://github.com/ruby/ruby/blob/trunk/lib/reline/unicode.rb#L101
 
   def self.get_mbchar_width(mbchar)
     ord = mbchar.ord
-    if (0x00 <= ord and ord <= 0x1F)
+    if (0x00 <= ord and ord <= 0x1F) # in EscapedPairs
       return 2
-    elsif (0x20 <= ord and ord <= 0x7E)
+    elsif (0x20 <= ord and ord <= 0x7E) # printable ASCII chars
       return 1
     end
     m = mbchar.encode(Encoding::UTF_8).match(MBCharWidthRE)
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]