From 36aeb12aa91976e8a8872fd575fe195dbd760964 Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Tue, 3 Dec 2024 01:44:44 +0900 Subject: [ruby/reline] Implement buffered output to Reline::ANSI (https://github.com/ruby/reline/pull/790) Minimize the call of STDOUT.write This will improve rendering performance especially when there is a busy thread `Thread.new{loop{}}` https://github.com/ruby/reline/commit/a6fe45f5ba --- test/reline/test_line_editor.rb | 5 ++++- test/reline/test_macro.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/reline/test_line_editor.rb b/test/reline/test_line_editor.rb index 256ce99241..85a814a799 100644 --- a/test/reline/test_line_editor.rb +++ b/test/reline/test_line_editor.rb @@ -61,6 +61,10 @@ class Reline::LineEditor class RenderLineDifferentialTest < Reline::TestCase class TestIO < Reline::IO + def write(string) + @output << string + end + def move_cursor_column(col) @output << "[COL_#{col}]" end @@ -76,7 +80,6 @@ class Reline::LineEditor @original_iogate = Reline::IOGate @output = StringIO.new @line_editor.instance_variable_set(:@screen_size, [24, 80]) - @line_editor.instance_variable_set(:@output, @output) Reline.send(:remove_const, :IOGate) Reline.const_set(:IOGate, TestIO.new) Reline::IOGate.instance_variable_set(:@output, @output) diff --git a/test/reline/test_macro.rb b/test/reline/test_macro.rb index 319d7b76b1..bfee280c72 100644 --- a/test/reline/test_macro.rb +++ b/test/reline/test_macro.rb @@ -6,7 +6,7 @@ class Reline::MacroTest < Reline::TestCase @config = Reline::Config.new @encoding = Reline.core.encoding @line_editor = Reline::LineEditor.new(@config) - @output = @line_editor.output = File.open(IO::NULL, "w") + @output = Reline::IOGate.output = File.open(IO::NULL, "w") end def teardown -- cgit v1.2.3