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

ruby-changes:58298

From: aycabta <ko1@a...>
Date: Fri, 18 Oct 2019 02:55:26 +0900 (JST)
Subject: [ruby-changes:58298] 8c0629ba58 (master): Treat key sequences from getwch() that start from 0 or 0xE0 correctly

https://git.ruby-lang.org/ruby.git/commit/?id=8c0629ba58

From 8c0629ba58c5c95b970a657493d261356eedea1d Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Fri, 18 Oct 2019 02:51:12 +0900
Subject: Treat key sequences from getwch() that start from 0 or 0xE0 correctly


diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index efde9d1..477152e 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -90,6 +90,12 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L90
     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)
-- 
cgit v0.10.2


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

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