1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Treat return key correctly on Windows

To fix Reline::TestRendering#test_binding_for_vi_movement_mode.

https://github.com/ruby/reline/commit/0df3d2a1dc
This commit is contained in:
aycabta 2021-04-23 13:29:20 +09:00
parent 754bfc66f8
commit 26f31f880c

View file

@ -85,6 +85,7 @@ class Reline::Windows
end
end
VK_RETURN = 0x0D
VK_MENU = 0x12
VK_LMENU = 0xA4
VK_CONTROL = 0x11
@ -207,7 +208,12 @@ class Reline::Windows
elsif char_code == 0 and control_key_state != 0
# unknown
else
@@output_buf.concat(char.bytes)
case virtual_key_code
when VK_RETURN
@@output_buf.push("\n".ord)
else
@@output_buf.concat(char.bytes)
end
end
end