Skip to content

Commit db0a923

Browse files
authored
Always use alternate sceen on alt-d (#988)
1 parent 5151467 commit db0a923

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

lib/irb/easter-egg.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def render_frame(i)
125125
canvas = Canvas.new(Reline.get_screen_size)
126126
end
127127
ruby_model = RubyModel.new
128-
print "\e[?1049h"
129128
0.step do |i| # TODO (0..).each needs Ruby 2.6 or later
130129
buff = canvas.draw do
131130
ruby_model.render_frame(i) do |p1, p2|

lib/irb/input-method.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,15 @@ def show_doc_dialog_proc
348348
if show_easter_egg
349349
IRB.__send__(:easter_egg)
350350
else
351+
# RDoc::RI::Driver#display_names uses pager command internally.
352+
# Some pager command like `more` doesn't use alternate screen
353+
# so we need to turn on and off alternate screen manually.
351354
begin
355+
print "\e[?1049h"
352356
driver.display_names([name])
353357
rescue RDoc::RI::Driver::NotFoundError
358+
ensure
359+
print "\e[?1049l"
354360
end
355361
end
356362
end

0 commit comments

Comments
 (0)