fix(examples): reset cursor on ctrl+c in counter example#198
Merged
ccbrown merged 1 commit intoApr 26, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
=======================================
Coverage 88.00% 88.00%
=======================================
Files 35 35
Lines 5662 5662
Branches 5662 5662
=======================================
Hits 4983 4983
Misses 569 569
Partials 110 110 🚀 New features to boost your workflow:
|
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What It Does
Adds the maintainer's option-1 fix from #197 to
examples/counter.rs: a singlehooks.use_terminal_events(|_| {})call (with a comment explaining why) that puts the terminal in raw mode so ctrl+c is delivered as a key event instead of a SIGINT. With raw mode active, the existingignore_ctrl_cpath inpackages/iocraft/src/element.rs:514exits the render loop cleanly and runs drop handlers, which restores the cursor. Every other interactive example already does this (use_input.rs:15,weather.rs:222,fullscreen.rs:19,scrolling.rs:14,form.rs:58,calculator.rs:261); the counter example was the outlier.This is intentionally the smallest possible change. The library itself is untouched and no new dependencies are added, matching the maintainer's note that iocraft should not set a global signal handler. If you'd rather close this in favor of a documentation-only approach (the second half of your suggestion), this PR can be discarded without churn.
Related Issues
Closes #197
This contribution was developed with AI assistance (Codex).