mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 04:55:21 +02:00
Use Shift+Enter as Meta+Enter on Windows
This commit is contained in:
parent
8b135cc875
commit
f6b62d8fe7
1 changed files with 7 additions and 1 deletions
|
@ -40,6 +40,7 @@ class Reline::Windows
|
|||
end
|
||||
|
||||
VK_MENU = 0x12
|
||||
VK_SHIFT = 0x10
|
||||
STD_OUTPUT_HANDLE = -11
|
||||
@@getwch = Win32API.new('msvcrt', '_getwch', [], 'I')
|
||||
@@kbhit = Win32API.new('msvcrt', '_kbhit', [], 'I')
|
||||
|
@ -75,7 +76,12 @@ class Reline::Windows
|
|||
end
|
||||
input = getwch
|
||||
alt = (@@GetKeyState.call(VK_MENU) & 0x80) != 0
|
||||
if input.size > 1
|
||||
shift_enter = (@@GetKeyState.call(VK_SHIFT) & 0x80) != 0 and input.first == 0x0D
|
||||
if shift_enter
|
||||
# It's treated as Meta+Enter on Windows
|
||||
@@buf.concat(["\e".ord])
|
||||
@@buf.concat(input)
|
||||
elsif input.size > 1
|
||||
@@buf.concat(input)
|
||||
else # single byte
|
||||
case input[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue