[ruby/reline] Suppress auto indent for adding newlines in pasting
Co-authored-by: Juanito Fatas <me@juanitofatas.com> https://github.com/ruby/reline/commit/074bb017a7
This commit is contained in:
parent
76c9a3c8c6
commit
01235f800f
@ -1339,7 +1339,7 @@ class Reline::LineEditor
|
|||||||
cursor_line = @line.byteslice(0, @byte_pointer)
|
cursor_line = @line.byteslice(0, @byte_pointer)
|
||||||
insert_new_line(cursor_line, next_line)
|
insert_new_line(cursor_line, next_line)
|
||||||
@cursor = 0
|
@cursor = 0
|
||||||
@check_new_auto_indent = true
|
@check_new_auto_indent = true unless Reline::IOGate.in_pasting?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -663,6 +663,21 @@ begin
|
|||||||
EOC
|
EOC
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_suppress_auto_indent_for_adding_newlines_in_pasting
|
||||||
|
start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/bin/multiline_repl --auto-indent}, startup_message: 'Multiline REPL.')
|
||||||
|
write("<<~Q\n")
|
||||||
|
write("{\n #\n}")
|
||||||
|
write("#")
|
||||||
|
close
|
||||||
|
assert_screen(<<~EOC)
|
||||||
|
Multiline REPL.
|
||||||
|
prompt> <<~Q
|
||||||
|
prompt> {
|
||||||
|
prompt> #
|
||||||
|
prompt> }#
|
||||||
|
EOC
|
||||||
|
end
|
||||||
|
|
||||||
private def write_inputrc(content)
|
private def write_inputrc(content)
|
||||||
File.open(@inputrc_file, 'w') do |f|
|
File.open(@inputrc_file, 'w') do |f|
|
||||||
f.write content
|
f.write content
|
||||||
|
Loading…
x
Reference in New Issue
Block a user