diff options
author | aycabta <aycabta@gmail.com> | 2021-04-23 13:29:20 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-06-21 17:58:48 +0900 |
commit | 26f31f880cef107d4c13dfe90a988c0f2e185338 (patch) | |
tree | ff99a59303ff5c400d2a64573d8ac4fcb81ee070 /lib/reline | |
parent | 754bfc66f85071295d2c46ba325f5847ef678a72 (diff) |
[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
Diffstat (limited to 'lib/reline')
-rw-r--r-- | lib/reline/windows.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb index 50cfe3f7df..46f8795daa 100644 --- a/lib/reline/windows.rb +++ b/lib/reline/windows.rb @@ -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 |