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

[ruby/reline] Windows cmd: Don't type anything when pressing ALT keys alone

Fixes #298

https://github.com/ruby/reline/commit/72acfcd27a
This commit is contained in:
Lars Kanis 2021-07-08 10:09:38 +02:00 committed by aycabta
parent 5313d234e0
commit 03f8c27179
2 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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(%{> })'}