ruby-changes:66519
From: aycabta <ko1@a...>
Date: Mon, 21 Jun 2021 18:44:34 +0900 (JST)
Subject: [ruby-changes:66519] 26f31f880c (master): [ruby/reline] Treat return key correctly on Windows
https://git.ruby-lang.org/ruby.git/commit/?id=26f31f880c From 26f31f880cef107d4c13dfe90a988c0f2e185338 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Fri, 23 Apr 2021 13:29:20 +0900 Subject: [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 --- lib/reline/windows.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb index 50cfe3f..46f8795 100644 --- a/lib/reline/windows.rb +++ b/lib/reline/windows.rb @@ -85,6 +85,7 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L85 end end + VK_RETURN = 0x0D VK_MENU = 0x12 VK_LMENU = 0xA4 VK_CONTROL = 0x11 @@ -207,7 +208,12 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L208 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 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/