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