diff options
-rw-r--r-- | lib/reline/line_editor.rb | 6 | ||||
-rw-r--r-- | test/reline/yamatanooroti/test_rendering.rb | 17 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 90cc4b2db2..dc0dcc6bbc 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -470,8 +470,12 @@ class Reline::LineEditor @add_newline_to_end_of_buffer = false else if @just_cursor_moving and not @rerender_all + @dialogs.each do |dialog| + clear_each_dialog(dialog) + dialog.contents = nil + dialog.trap_key = nil + end rendered = just_move_cursor - render_dialog((prompt_width + @cursor) % @screen_size.last) @just_cursor_moving = false return elsif @previous_line_index or new_highest_in_this != @highest_in_this diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index 5b95a14d0e..a1aab6bfee 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -1254,6 +1254,23 @@ begin EOC end + def test_clear_dialog_when_just_move_cursor_at_last_line + start_terminal(10, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.') + write("class A\n 3\nend\n") + write("\C-p\C-p\C-p\C-e\C-hS") + write("\C-n") + write("1") + close + assert_screen(<<~'EOC') + prompt> 3 + prompt> end + => 3 + prompt> class S + prompt> 31 + prompt> end + EOC + end + def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content |