mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
f1d4216bd9
commit
6df6611ce7
1 changed files with 3 additions and 2 deletions
|
@ -62,6 +62,7 @@ class Reline::Windows
|
||||||
end
|
end
|
||||||
|
|
||||||
VK_MENU = 0x12
|
VK_MENU = 0x12
|
||||||
|
VK_LMENU = 0xA4
|
||||||
VK_CONTROL = 0x11
|
VK_CONTROL = 0x11
|
||||||
VK_SHIFT = 0x10
|
VK_SHIFT = 0x10
|
||||||
STD_INPUT_HANDLE = -10
|
STD_INPUT_HANDLE = -10
|
||||||
|
@ -124,7 +125,7 @@ class Reline::Windows
|
||||||
return @@output_buf.shift
|
return @@output_buf.shift
|
||||||
end
|
end
|
||||||
input = getwch
|
input = getwch
|
||||||
alt = (@@GetKeyState.call(VK_MENU) & 0x80) != 0
|
meta = (@@GetKeyState.call(VK_LMENU) & 0x80) != 0
|
||||||
control = (@@GetKeyState.call(VK_CONTROL) & 0x80) != 0
|
control = (@@GetKeyState.call(VK_CONTROL) & 0x80) != 0
|
||||||
shift = (@@GetKeyState.call(VK_SHIFT) & 0x80) != 0
|
shift = (@@GetKeyState.call(VK_SHIFT) & 0x80) != 0
|
||||||
force_enter = !input.instance_of?(Array) && (control or shift) && input == 0x0D
|
force_enter = !input.instance_of?(Array) && (control or shift) && input == 0x0D
|
||||||
|
@ -149,7 +150,7 @@ class Reline::Windows
|
||||||
@@output_buf.push(input)
|
@@output_buf.push(input)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if alt
|
if meta
|
||||||
"\e".ord
|
"\e".ord
|
||||||
else
|
else
|
||||||
@@output_buf.shift
|
@@output_buf.shift
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue