From 0cf073088ef1a0a3c7d49038ba2d67547b5ed16b Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 27 Nov 2020 23:11:46 +0900 Subject: [PATCH] [ruby/reline] Process insertion buffer forcibly https://github.com/ruby/reline/commit/89d49ec9e0 --- lib/reline/line_editor.rb | 1 + test/reline/yamatanooroti/test_rendering.rb | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 044b7c3159..f8be32e913 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -324,6 +324,7 @@ class Reline::LineEditor def rerender_all @rerender_all = true + process_insert(force: true) rerender end diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index 7c87d9588a..84c0580e4b 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -6,7 +6,8 @@ begin class Reline::TestRendering < Yamatanooroti::TestCase def setup @pwd = Dir.pwd - @tmpdir = File.join(File.expand_path(Dir.tmpdir), "test_reline_config_#{$$}") + suffix = '%010d' % Random.rand(0..65535) + @tmpdir = File.join(File.expand_path(Dir.tmpdir), "test_reline_config_#{$$}_#{suffix}") begin Dir.mkdir(@tmpdir) rescue Errno::EEXIST @@ -429,15 +430,14 @@ begin LINES start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/bin/multiline_repl}, startup_message: 'Multiline REPL.') write("\e[200~,") - write("def hoge\n 3\nend\n") + write("def hoge\n 3\nend") write("\e[200~.") close assert_screen(<<~EOC) + Multiline REPL. prompt> def hoge prompt> 3 prompt> end - => :hoge - prompt> EOC end