[ruby/reline] Support inserting C-c C-z C-\ with quoted_insert
(https://github.com/ruby/reline/pull/798) https://github.com/ruby/reline/commit/e6eb5d2d3c
This commit is contained in:
parent
341503d1a3
commit
3e8f0e5589
@ -309,6 +309,13 @@ class Reline::ANSI < Reline::IO
|
|||||||
# Signal.trap may raise an ArgumentError if the platform doesn't support the signal.
|
# Signal.trap may raise an ArgumentError if the platform doesn't support the signal.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def read_single_char(keyseq_timeout)
|
||||||
|
# Disable intr to read `C-c` `C-z` `C-\` for quoted insert
|
||||||
|
@input.raw(intr: false) do
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def prep
|
def prep
|
||||||
# Enable bracketed paste
|
# Enable bracketed paste
|
||||||
write "\e[?2004h" if Reline.core.config.enable_bracketed_paste && both_tty?
|
write "\e[?2004h" if Reline.core.config.enable_bracketed_paste && both_tty?
|
||||||
|
@ -28,6 +28,7 @@ class Reline::Unicode
|
|||||||
0x19 => '^Y',
|
0x19 => '^Y',
|
||||||
0x1A => '^Z', # C-z
|
0x1A => '^Z', # C-z
|
||||||
0x1B => '^[', # C-[ C-3
|
0x1B => '^[', # C-[ C-3
|
||||||
|
0x1C => '^\\', # C-\
|
||||||
0x1D => '^]', # C-]
|
0x1D => '^]', # C-]
|
||||||
0x1E => '^^', # C-~ C-6
|
0x1E => '^^', # C-~ C-6
|
||||||
0x1F => '^_', # C-_ C-7
|
0x1F => '^_', # C-_ C-7
|
||||||
|
@ -1724,6 +1724,26 @@ begin
|
|||||||
close
|
close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_quoted_insert_intr_keys
|
||||||
|
omit if Reline.core.io_gate.win?
|
||||||
|
start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
|
||||||
|
write '"'
|
||||||
|
write "\C-v"
|
||||||
|
write "\C-c"
|
||||||
|
write "\C-v"
|
||||||
|
write "\C-z"
|
||||||
|
write "\C-v"
|
||||||
|
write "\C-\\"
|
||||||
|
write "\".bytes\n"
|
||||||
|
assert_screen(<<~EOC)
|
||||||
|
Multiline REPL.
|
||||||
|
prompt> "^C^Z^\\\".bytes
|
||||||
|
=> [3, 26, 28]
|
||||||
|
prompt>
|
||||||
|
EOC
|
||||||
|
close
|
||||||
|
end
|
||||||
|
|
||||||
def test_print_before_readline
|
def test_print_before_readline
|
||||||
code = <<~RUBY
|
code = <<~RUBY
|
||||||
puts 'Multiline REPL.'
|
puts 'Multiline REPL.'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user