summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/reline/line_editor.rb2
-rw-r--r--test/reline/yamatanooroti/test_rendering.rb15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 65004cad18..31211cda33 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -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
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index 9c8df1f215..f4a5919b6c 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -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