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
72acfcd27a
This commit is contained in:
parent
5313d234e0
commit
03f8c27179
2 changed files with 13 additions and 3 deletions
|
@ -190,9 +190,6 @@ class Reline::Windows
|
||||||
# It's treated as Meta+Space on Windows.
|
# It's treated as Meta+Space on Windows.
|
||||||
@@output_buf.push("\e".ord)
|
@@output_buf.push("\e".ord)
|
||||||
@@output_buf.push(char_code)
|
@@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)
|
elsif control_key_state.anybits?(ENHANCED_KEY)
|
||||||
case virtual_key_code # Emulate getwch() key sequences.
|
case virtual_key_code # Emulate getwch() key sequences.
|
||||||
when VK_END
|
when VK_END
|
||||||
|
|
|
@ -775,6 +775,19 @@ begin
|
||||||
EOC
|
EOC
|
||||||
end
|
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
|
def test_with_newline
|
||||||
omit if Reline::IOGate.win?
|
omit if Reline::IOGate.win?
|
||||||
cmd = %Q{ruby -e 'print(%Q{abc def \\e\\r})' | ruby -I#{@pwd}/lib -rreline -e 'p Reline.readline(%{> })'}
|
cmd = %Q{ruby -e 'print(%Q{abc def \\e\\r})' | ruby -I#{@pwd}/lib -rreline -e 'p Reline.readline(%{> })'}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue