From 7159af3491763aeeaf7accec426ff228d7dbfa3b Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 16 Dec 2021 10:19:52 +0900 Subject: [PATCH] [ruby/reline] Clear dialog in pasting https://github.com/ruby/reline/commit/dabf5313e0 --- lib/reline/line_editor.rb | 1 + test/reline/yamatanooroti/test_rendering.rb | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 39e2b427bc..4fbed471c3 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -651,6 +651,7 @@ class Reline::LineEditor private def render_each_dialog(dialog, cursor_column) if @in_pasting + clear_each_dialog(dialog) dialog.contents = nil dialog.trap_key = nil return diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index e369c977f4..0d1100f70c 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -1217,6 +1217,17 @@ begin EOC end + def test_clear_dialog_in_pasting + start_terminal(10, 40, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.') + write("S") + write("tring ") + close + assert_screen(<<~'EOC') + Multiline REPL. + prompt> String + EOC + end + def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content