mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Clear dialog when adding new line to end of buffer
https://github.com/ruby/reline/commit/7d38454327
This commit is contained in:
parent
5ec3450438
commit
f94a2adf6a
2 changed files with 22 additions and 0 deletions
|
@ -466,6 +466,11 @@ class Reline::LineEditor
|
|||
new_highest_in_this = calculate_height_by_width(prompt_width + calculate_width(@line.nil? ? '' : @line))
|
||||
rendered = false
|
||||
if @add_newline_to_end_of_buffer
|
||||
@dialogs.each do |dialog|
|
||||
clear_each_dialog(dialog)
|
||||
dialog.contents = nil
|
||||
dialog.trap_key = nil
|
||||
end
|
||||
rerender_added_newline(prompt, prompt_width)
|
||||
@add_newline_to_end_of_buffer = false
|
||||
else
|
||||
|
|
|
@ -1271,6 +1271,23 @@ begin
|
|||
EOC
|
||||
end
|
||||
|
||||
def test_clear_dialog_when_adding_new_line_to_end_of_buffer
|
||||
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("class S")
|
||||
write("\n")
|
||||
write(" 3")
|
||||
close
|
||||
assert_screen(<<~'EOC')
|
||||
prompt> end
|
||||
prompt> end
|
||||
=> :a
|
||||
prompt> class S
|
||||
prompt> 3
|
||||
EOC
|
||||
end
|
||||
|
||||
def write_inputrc(content)
|
||||
File.open(@inputrc_file, 'w') do |f|
|
||||
f.write content
|
||||
|
|
Loading…
Reference in a new issue