diff options
-rw-r--r-- | lib/reline/line_editor.rb | 5 | ||||
-rw-r--r-- | test/reline/yamatanooroti/test_rendering.rb | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index dc0dcc6bbc..295af526fe 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -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 diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index a1aab6bfee..bb0ac4e860 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -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 |