From d667008ae581d141c34fdb0a805307d518907391 Mon Sep 17 00:00:00 2001 From: Mari Imaizumi Date: Sat, 30 Nov 2024 21:49:32 +0900 Subject: [PATCH] Prevent cursor flickering --- lib/irb/easter-egg.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/irb/easter-egg.rb b/lib/irb/easter-egg.rb index bf8884838..07b6137be 100644 --- a/lib/irb/easter-egg.rb +++ b/lib/irb/easter-egg.rb @@ -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| @@ -138,6 +139,7 @@ def render_frame(i) end rescue Interrupt ensure + print "\e[?25h" # show cursor trap("SIGINT", prev_trap) end end