From db0a923d620d2c6b039b6c27927f65003b387820 Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Sat, 19 Oct 2024 02:15:05 +0900 Subject: [PATCH] Always use alternate sceen on alt-d (#988) --- lib/irb/easter-egg.rb | 1 - lib/irb/input-method.rb | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/irb/easter-egg.rb b/lib/irb/easter-egg.rb index 14dc93fc9..bf8884838 100644 --- a/lib/irb/easter-egg.rb +++ b/lib/irb/easter-egg.rb @@ -125,7 +125,6 @@ def render_frame(i) canvas = Canvas.new(Reline.get_screen_size) end ruby_model = RubyModel.new - print "\e[?1049h" 0.step do |i| # TODO (0..).each needs Ruby 2.6 or later buff = canvas.draw do ruby_model.render_frame(i) do |p1, p2| diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 38f05d771..260d9a1cb 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -348,9 +348,15 @@ def show_doc_dialog_proc if show_easter_egg IRB.__send__(:easter_egg) else + # RDoc::RI::Driver#display_names uses pager command internally. + # Some pager command like `more` doesn't use alternate screen + # so we need to turn on and off alternate screen manually. begin + print "\e[?1049h" driver.display_names([name]) rescue RDoc::RI::Driver::NotFoundError + ensure + print "\e[?1049l" end end end