Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent cursor flickering in dancing ruby #1041

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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