зеркало из https://github.com/github/ruby.git
[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:
Родитель
76c9a3c8c6
Коммит
01235f800f
|
@ -1339,7 +1339,7 @@ class Reline::LineEditor
|
|||
cursor_line = @line.byteslice(0, @byte_pointer)
|
||||
insert_new_line(cursor_line, next_line)
|
||||
@cursor = 0
|
||||
@check_new_auto_indent = true
|
||||
@check_new_auto_indent = true unless Reline::IOGate.in_pasting?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -663,6 +663,21 @@ begin
|
|||
EOC
|
||||
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)
|
||||
File.open(@inputrc_file, 'w') do |f|
|
||||
f.write content
|
||||
|
|
Загрузка…
Ссылка в новой задаче