Skip to content

Commit 074bb01

Browse files
aycabtaJuanitoFatas
andcommitted
Suppress auto indent for adding newlines in pasting
Co-authored-by: Juanito Fatas <me@juanitofatas.com>
1 parent 558f7be commit 074bb01

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/reline/line_editor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ def finish
13391339
cursor_line = @line.byteslice(0, @byte_pointer)
13401340
insert_new_line(cursor_line, next_line)
13411341
@cursor = 0
1342-
@check_new_auto_indent = true
1342+
@check_new_auto_indent = true unless Reline::IOGate.in_pasting?
13431343
end
13441344
end
13451345

test/reline/yamatanooroti/test_rendering.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,21 @@ def test_suppress_auto_indent_just_after_pasted
663663
EOC
664664
end
665665

666+
def test_suppress_auto_indent_for_adding_newlines_in_pasting
667+
start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/bin/multiline_repl --auto-indent}, startup_message: 'Multiline REPL.')
668+
write("<<~Q\n")
669+
write("{\n #\n}")
670+
write("#")
671+
close
672+
assert_screen(<<~EOC)
673+
Multiline REPL.
674+
prompt> <<~Q
675+
prompt> {
676+
prompt> #
677+
prompt> }#
678+
EOC
679+
end
680+
666681
private def write_inputrc(content)
667682
File.open(@inputrc_file, 'w') do |f|
668683
f.write content

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy