[ruby/reline] Do not send color reset sequence when GeneralIO is

used
(https://github.com/ruby/reline/pull/661)

3719702808
This commit is contained in:
tomoya ishida 2024-03-24 08:00:18 +09:00 committed by git
parent f46b77596d
commit 3adaba0e81
5 changed files with 21 additions and 9 deletions

View file

@ -4,6 +4,18 @@ require 'stringio'
class Reline::LineEditor
class RenderLineDifferentialTest < Reline::TestCase
module TestIO
RESET_COLOR = "\e[0m"
def self.move_cursor_column(col)
@output << "[COL_#{col}]"
end
def self.erase_after_cursor
@output << '[ERASE]'
end
end
def setup
verbose, $VERBOSE = $VERBOSE, nil
@line_editor = Reline::LineEditor.new(nil, Encoding::UTF_8)
@ -12,14 +24,8 @@ class Reline::LineEditor
@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, Object.new)
Reline.const_set(:IOGate, TestIO)
Reline::IOGate.instance_variable_set(:@output, @output)
def (Reline::IOGate).move_cursor_column(col)
@output << "[COL_#{col}]"
end
def (Reline::IOGate).erase_after_cursor
@output << '[ERASE]'
end
ensure
$VERBOSE = verbose
end