summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2021-07-08 10:09:38 +0200
committeraycabta <aycabta@gmail.com>2021-07-30 02:27:02 +0900
commit03f8c271796ffb976487495f1675ec7583b6762d (patch)
tree7eaa20c2ff3ac7bdcae7b3f899e65514c2b781f0
parent5313d234e01b5f34f969be265ec2cea7e921f9ae (diff)
[ruby/reline] Windows cmd: Don't type anything when pressing ALT keys alone
Fixes #298 https://github.com/ruby/reline/commit/72acfcd27a
-rw-r--r--lib/reline/windows.rb3
-rw-r--r--test/reline/yamatanooroti/test_rendering.rb13
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/reline/windows.rb b/lib/reline/windows.rb
index 072fb1b6cd..4a36bf40d3 100644
--- a/lib/reline/windows.rb
+++ b/lib/reline/windows.rb
@@ -190,9 +190,6 @@ class Reline::Windows
# It's treated as Meta+Space on Windows.
@@output_buf.push("\e".ord)
@@output_buf.push(char_code)
- elsif control_key_state.anybits?(LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)
- @@output_buf.push("\e".ord)
- @@output_buf.concat(char.bytes)
elsif control_key_state.anybits?(ENHANCED_KEY)
case virtual_key_code # Emulate getwch() key sequences.
when VK_END
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 612fcc57c5..d2e73ca8cb 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -775,6 +775,19 @@ begin
EOC
end
+ def test_brackets
+ omit unless Reline::IOGate.win?
+ start_terminal(20, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
+ write("\x80\M-[\x80\M-{\x80\M-}\x80\M-]\n")
+ close
+ assert_screen(<<~EOC)
+ Multiline REPL.
+ prompt> [{}]
+ => [{}]
+ prompt>
+ EOC
+ end
+
def test_with_newline
omit if Reline::IOGate.win?
cmd = %Q{ruby -e 'print(%Q{abc def \\e\\r})' | ruby -I#{@pwd}/lib -rreline -e 'p Reline.readline(%{> })'}