I've been playing around with raw mode in the basic-cli platform to make a termion like package. It is a nice experience, but I found the following annoying.
At the moment, when an app using the basic-cli platform panics while raw mode is enabled, it will stay in raw mode. I think it would be nice if it automatically disabled raw mode. I think this should be possible in the roc_panic function somehow?
Good idea, you could use crossterm::terminal::is_raw_mode_enabled() and crossterm::terminal::disable_raw_mode() in the panic function. But I think it is better to set our own boolean when roc_fx_ttyModeRaw is called and checking that to prevent us from having to call more complex crossterm code on every panic. Can you write up an issue for that @Kilian Vounckx? If you want to implement that I'd be happy to review it :)
Issue raised!
This week I don't have the time to implement it, but if the issue is still open after that, I will tackle it
Thanks! sounds good :+1:
I have an hour or two free after studying now, so maybe I can handle it now. I've been looking at how crossterm does this function and they have a fancy mutex from the parking_lot crate containing an optional termios. That made me wonder, is basic-cli multithreaded? If so, is using an AtomicBool enough for handling that? If not, should we future-proof this implementation and make it atomic, or is this overhead too much? I would think not, because I don't expect the AtomicBool to be accessed too much (only when enabling or disabling, and on panics)
Also, if we have this bool, should we also expose a function to the platform? Something like isRawModeEnabled : Task Bool * in the Tty interface
I implemented it with an AtomicBool in this PR
I figured adding isRawEnabled should probably be its own PR
@Anton Just checking if you saw this as someone needs to review the PR :blush:
Yes, I'll check it in a bit :)
Last updated: Jun 16 2026 at 16:19 UTC