1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Insert newline in the middle of buffer just after dialog

0c76631132
This commit is contained in:
aycabta 2022-01-12 19:46:33 +09:00 committed by git
parent d1e078e71c
commit 921ff739df
2 changed files with 22 additions and 0 deletions

View file

@ -476,6 +476,7 @@ class Reline::LineEditor
@just_cursor_moving = false
return
elsif @previous_line_index or new_highest_in_this != @highest_in_this
clear_dialog_with_content
rerender_changed_current_line
@previous_line_index = nil
rendered = true

View file

@ -1289,6 +1289,27 @@ begin
EOC
end
def test_insert_newline_in_the_middle_of_buffer_just_after_dialog
start_terminal(10, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.')
write("class A\n def a\n 3\n end\nend")
write("\n")
write("\C-p\C-p\C-p\C-p\C-p\C-e\C-hS")
write("\M-\x0D")
write(" 3")
close
assert_screen(<<~'EOC')
prompt> end
prompt> end
=> :a
prompt> class S
prompt> 3
prompt> def a
prompt> 3
prompt> end
prompt> end
EOC
end
def write_inputrc(content)
File.open(@inputrc_file, 'w') do |f|
f.write content