Skip to content

Commit

Permalink
Prevent cursor flickering (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
ima1zumi authored Nov 30, 2024
1 parent 4217a46 commit 0506ed0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/irb/easter-egg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def render_frame(i)
canvas = Canvas.new(Reline.get_screen_size)
end
ruby_model = RubyModel.new
print "\e[?25l" # hide cursor
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|
Expand All @@ -138,6 +139,7 @@ def render_frame(i)
end
rescue Interrupt
ensure
print "\e[?25h" # show cursor
trap("SIGINT", prev_trap)
end
end
Expand Down

0 comments on commit 0506ed0

Please sign in to comment.