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

ruby-changes:58380

From: aycabta <ko1@a...>
Date: Thu, 24 Oct 2019 02:50:24 +0900 (JST)
Subject: [ruby-changes:58380] 6df6611ce7 (master): Treat only left alt key as meta-key on Windows

https://git.ruby-lang.org/ruby.git/commit/?id=6df6611ce7

From 6df6611ce77d1bb7d50375a1399e1d5101a3a616 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Thu, 24 Oct 2019 02:45:15 +0900
Subject: Treat only left alt key as meta-key on Windows

On German keyboard, right alt key acts as like shift key.

Ex. right-alt-8 is just "[". This input doesn't have meta-key statement.

diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index f83813a..3425c13 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -62,6 +62,7 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L62
   end
 
   VK_MENU = 0x12
+  VK_LMENU = 0xA4
   VK_CONTROL = 0x11
   VK_SHIFT = 0x10
   STD_INPUT_HANDLE = -10
@@ -124,7 +125,7 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L125
       return @@output_buf.shift
     end
     input = getwch
-    alt = (@@GetKeyState.call(VK_MENU) & 0x80) != 0
+    meta = (@@GetKeyState.call(VK_LMENU) & 0x80) != 0
     control = (@@GetKeyState.call(VK_CONTROL) & 0x80) != 0
     shift = (@@GetKeyState.call(VK_SHIFT) & 0x80) != 0
     force_enter = !input.instance_of?(Array) && (control or shift) && input == 0x0D
@@ -149,7 +150,7 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L150
         @@output_buf.push(input)
       end
     end
-    if alt
+    if meta
       "\e".ord
     else
       @@output_buf.shift
-- 
cgit v0.10.2


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

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