gyscos / gyscos/cursive

Allow suppression of Event::Exit

Open
#416 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

# Problem description
The termion backend puts stdout into raw mode which sets `-ISIG` to prevent the default `SIGINT` on `Ctrl-C`. In the event mapping from termion keys to cursive events, `Ctrl-C` is mapped directly to `Event::Exit`, and then in `on_event` on `Cursive`, `Event::Exit` is hardcoded directly to `quit()`.

I'm working on a project where I do not want to quit on `Ctrl-C` (or any other automatic exit event), but it's not straightforward to me how to suppress exit on `Ctrl-C` with this setup.

Maybe instead of having the top level check for `Event::Exit` in `on_event`, this can be preloaded into a default global callback so that it can easily be cleared or overridden?

Sorry if I've missed something and this is already simple to do :^)

# Environment

* Operating system: linux distribution, windows, macOS, ...
**GNU/Linux**
* Backend used: ncurses (the default one), pancurses, termion, ...
**termion**
* Current locale (run `locale` in a terminal).
**en_US.utf8**
* Cursive version (from crates.io, from git, ...)
**0.13.0 from crates.io**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.