summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-10-18 02:51:12 +0900
committeraycabta <aycabta@gmail.com>2019-10-18 02:54:20 +0900
commit8c0629ba58c5c95b970a657493d261356eedea1d (patch)
tree7f50c06f81f735f0f31ffda295f1b28d52622d2c /lib
parent58657fa134852311ce6ce2827f72ba2d1b29a8bb (diff)
Treat key sequences from getwch() that start from 0 or 0xE0 correctly
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/windows.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index efde9d1b38..477152e436 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -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)