gchp / iota

A terminal-based text editor written in Rust
MIT License
1.63k stars 81 forks source link

iota hangs after ctrl-q #16

Closed brson closed 9 years ago

brson commented 9 years ago

When I quit iota it returns to the command line but does not exit until I press ctrl-c. Commit dcd580807c2ffbe854fcac04fce23bd4ea14a85d built with rustc 0.13.0-nightly (8bca470c5 2014-12-08 00:12:30 +0000). Ubuntu 14.04.

gchp commented 9 years ago

Yeah, I've seen this happening for a while. I think its because of Editor::event_loop It starts a thread with an infinite loop which polls rustbox for events. When the running flag is set to false elsewhere in the programme the editor exits, however the event loop doesn't know to shut down. Could be something else, but fairly sure its that.

The solution would be to send a reference to running to the thread, so it will see when it changes and exit accordingly.