summaryrefslogtreecommitdiff
path: root/lib/reline/windows.rb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-12-24 13:58:19 +0900
committergit <svn-admin@ruby-lang.org>2021-12-24 13:57:46 +0900
commit3a59abab0875ef734311a6f74de10dc480445e4a (patch)
treed93c87a23921b7ad8df63a83eb670d9190f910ae /lib/reline/windows.rb
parent6050e3e2a6ce2269c56fa74bc5b75a94d064b61f (diff)
[ruby/reline] Determine 1st char or 2nd char of surrogate pair correctly
https://github.com/ruby/reline/commit/182606c847
Diffstat (limited to 'lib/reline/windows.rb')
-rw-r--r--lib/reline/windows.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index a89bd30415..f46ebd2109 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -220,12 +220,12 @@ class Reline::Windows
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