mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Determine 1st char or 2nd char of surrogate pair correctly
182606c847
This commit is contained in:
parent
6050e3e2a6
commit
3a59abab08
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
def self.process_key_event(repeat_count, virtual_key_code, virtual_scan_code, char_code, control_key_state)
|
||||||
|
|
||||||
# high-surrogate
|
# high-surrogate
|
||||||
if char_code & 0xDC00 == 0xD800
|
if 0xD800 <= char_code and char_code <= 0xDBFF
|
||||||
@@hsg = char_code
|
@@hsg = char_code
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
# low-surrogate
|
# low-surrogate
|
||||||
if char_code & 0xDC00 == 0xDC00
|
if 0xDC00 <= char_code and char_code <= 0xDFFF
|
||||||
if @@hsg
|
if @@hsg
|
||||||
char_code = 0x10000 + (@@hsg - 0xD800) * 0x400 + char_code - 0xDC00
|
char_code = 0x10000 + (@@hsg - 0xD800) * 0x400 + char_code - 0xDC00
|
||||||
@@hsg = nil
|
@@hsg = nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue