ruby-changes:58377
From: aycabta <ko1@a...>
Date: Thu, 24 Oct 2019 00:15:44 +0900 (JST)
Subject: [ruby-changes:58377] 7bc787fa06 (master): Support forced enter insertion by Ctrl+Enter on Windows
https://git.ruby-lang.org/ruby.git/commit/?id=7bc787fa06 From 7bc787fa06e20f26fae875c9aac2675fc056e16d Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Thu, 24 Oct 2019 00:12:52 +0900 Subject: Support forced enter insertion by Ctrl+Enter on Windows diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb index 47cb612..f83813a 100644 --- a/lib/reline/windows.rb +++ b/lib/reline/windows.rb @@ -62,6 +62,7 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L62 end VK_MENU = 0x12 + VK_CONTROL = 0x11 VK_SHIFT = 0x10 STD_INPUT_HANDLE = -10 STD_OUTPUT_HANDLE = -11 @@ -124,8 +125,10 @@ class Reline::Windows https://github.com/ruby/ruby/blob/trunk/lib/reline/windows.rb#L125 end input = getwch alt = (@@GetKeyState.call(VK_MENU) & 0x80) != 0 - shift_enter = !input.instance_of?(Array) && (@@GetKeyState.call(VK_SHIFT) & 0x80) != 0 && input == 0x0D - if shift_enter + control = (@@GetKeyState.call(VK_CONTROL) & 0x80) != 0 + shift = (@@GetKeyState.call(VK_SHIFT) & 0x80) != 0 + force_enter = !input.instance_of?(Array) && (control or shift) && input == 0x0D + if force_enter # It's treated as Meta+Enter on Windows @@output_buf.push("\e".ord) @@output_buf.push(input) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/