From bd7b2255ba696150706a015e2b9f1bd8a74866d6 Mon Sep 17 00:00:00 2001 From: HASUMI Hitoshi Date: Fri, 6 Nov 2026 17:31:38 +0900 Subject: [PATCH] Use the IO gate of the core, not the constant Reline::IOGate Reline keeps the gate in use in Reline.core.io_gate; the constant is the gate decided at load time. A program that gives Reline another gate (a terminal behind a socket) keeps the constant as it was, so in_pasting? asked the wrong gate: on a STDIN at EOF the default gate says "pasting", and a line never submits. The easter egg had the same three reads. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01VpVYsAE2Eb17FkqeVd1gKE --- lib/irb.rb | 2 +- lib/irb/easter-egg.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/irb.rb b/lib/irb.rb index 86a1b6f6b..5c317ea4d 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -322,7 +322,7 @@ def command?(code) def configure_io if @context.io.respond_to?(:check_termination) @context.io.check_termination do |code| - if Reline::IOGate.in_pasting? + if Reline.core.io_gate.in_pasting? rest = @scanner.check_termination_in_prev_line(code, local_variables: @context.local_variables) if rest Reline.delete_text diff --git a/lib/irb/easter-egg.rb b/lib/irb/easter-egg.rb index 82ae49965..c88d1e400 100644 --- a/lib/irb/easter-egg.rb +++ b/lib/irb/easter-egg.rb @@ -121,8 +121,8 @@ def render_frame(i) interrupted = false prev_trap = trap("SIGINT") { interrupted = true } canvas = Canvas.new(Reline.get_screen_size) - otio = Reline::IOGate.prep - Reline::IOGate.set_winch_handler do + otio = Reline.core.io_gate.prep + Reline.core.io_gate.set_winch_handler do canvas = Canvas.new(Reline.get_screen_size) end ruby_model = RubyModel.new @@ -140,7 +140,7 @@ def render_frame(i) end rescue Interrupt ensure - Reline::IOGate.deprep(otio) + Reline.core.io_gate.deprep(otio) print "\e[?25h" # show cursor trap("SIGINT", prev_trap) end