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

ruby-changes:70506

From: aycabta <ko1@a...>
Date: Fri, 24 Dec 2021 13:57:57 +0900 (JST)
Subject: [ruby-changes:70506] 3a59abab08 (master): [ruby/reline] Determine 1st char or 2nd char of surrogate pair correctly

https://git.ruby-lang.org/ruby.git/commit/?id=3a59abab08

From 3a59abab0875ef734311a6f74de10dc480445e4a Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Fri, 24 Dec 2021 13:58:19 +0900
Subject: [ruby/reline] Determine 1st char or 2nd char of surrogate pair
 correctly

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

diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index a89bd304152..f46ebd21091 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -220,12 +220,12 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L220
   def self.process_key_event(repeat_count, virtual_key_code, virtual_scan_code, char_code, control_key_state)
 
     # high-surrogate
-    if char_code & 0xDC00 == 0xD800
+    if 0xD800 <= char_code and char_code <= 0xDBFF
       @@hsg = char_code
       return
     end
     # low-surrogate
-    if char_code & 0xDC00 == 0xDC00
+    if 0xDC00 <= char_code and char_code <= 0xDFFF
       if @@hsg
         char_code = 0x10000 + (@@hsg - 0xD800) * 0x400 + char_code - 0xDC00
         @@hsg = nil
-- 
cgit v1.2.1


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

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