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

Add support for Ctrl-C handling #8

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Conversation

samuela
Copy link
Contributor

@samuela samuela commented Jan 11, 2024

Fix #7.

I was hoping that there would be a way to accomplish this without requiring any changes from user code, but I have not yet found a solution to Detegr/rust-ctrlc#106 (comment).

In any case, this PR fixes the issue such that Ctrl-C is now handled the same as Esc, assuming client code sets up a signal handler. Crucially it does not steal the user's cursor anymore.

@fadeevab
Copy link
Owner

@samuela Hey, thanks for the PR and for feature requests, I have just noticed them. I'll check it a bit later today or tomorrow!

Copy link
Owner

@fadeevab fadeevab left a comment

Choose a reason for hiding this comment

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

This is cool, I also experimented with ctrlc crate once trying to make Ctrl-C work I just didn't realize the empty handler is enough.

examples/basic.rs Outdated Show resolved Hide resolved
examples/basic_dynamic_items.rs Outdated Show resolved Hide resolved
examples/theme.rs Outdated Show resolved Hide resolved
@fadeevab
Copy link
Owner

@samuela Alternatively, I can merge this PR and correct it with my additional commit.

Co-authored-by: Alexander Fadeev <[email protected]>
@samuela
Copy link
Contributor Author

samuela commented Jan 14, 2024

Hi @fadeevab , thanks for your review! Just applied the suggestions in 3b5104b!

@fadeevab fadeevab merged commit 84774bf into fadeevab:main Jan 17, 2024
@fadeevab
Copy link
Owner

@samuela merged, thanks 👍

@samuela samuela deleted the samuela/ctrl-c branch January 17, 2024 02:04
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.

cliclack does not return cursor correctly on ctrl-c
2 participants