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

Treat key sequences from getwch() that start from 0 or 0xE0 correctly

This commit is contained in:
aycabta 2019-10-18 02:51:12 +09:00
parent 58657fa134
commit 8c0629ba58

View file

@ -90,6 +90,12 @@ class Reline::Windows
end
until @@kbhit.call == 0
ret = @@getwch.call
if ret == 0 or ret == 0xE0
@@input_buf << ret
ret = @@getwch.call
@@input_buf << ret
return @@input_buf.shift
end
begin
bytes = ret.chr(Encoding::UTF_8).encode(Encoding.default_external).bytes
@@input_buf.push(*bytes)