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

Fix cursor hiding in threaded run #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

orgads
Copy link

@orgads orgads commented Sep 15, 2023

Describe the change

Fix cursor hiding in threaded run.

Why are we doing this?

auto_spin ensure was called right after starting to spin, so the cursor was never actually hidden.

Benefits

See above.

Drawbacks

Requirements

  • Tests written & passing locally?
  • Code style checked?
  • Rebased with master branch?
  • Documentation updated?
  • Changelog updated?

spec/unit/auto_spin_spec.rb Outdated Show resolved Hide resolved
spec/unit/auto_spin_spec.rb Outdated Show resolved Hide resolved
@orgads orgads force-pushed the improve-hiding branch 2 times, most recently from a02199f to 2aa1e62 Compare September 15, 2023 07:18
Copy link
Owner

@piotrmurach piotrmurach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Orgad 👋

Nice spot with the issue! Thank you for submitting this PR. There are a few things to resolve before this can be considered for merging. We need an additional test in the auto_spin_spec.rb on top of what's already there that specifically raises inside the thread.

CHANGELOG.md Outdated Show resolved Hide resolved
lib/tty/spinner.rb Outdated Show resolved Hide resolved
lib/tty/spinner.rb Show resolved Hide resolved
spec/unit/auto_spin_spec.rb Outdated Show resolved Hide resolved
@orgads orgads force-pushed the improve-hiding branch 3 times, most recently from a5fd890 to 7aeda4d Compare September 20, 2023 14:02
spin
sleep(sleep_time)
end
rescue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RescueStandardError: Avoid rescuing without specifying an error class.

auto_spin ensure was called right after starting to spin, so the cursor
was never actually hidden.

Fix by calling the initial spin in the thread, and wrap the thread with
rescue that shows the cursor at the end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants