Refresh screen while awaiting/consuming CLI input

I have been exploring concurrency and state while working on a text adventure game and one of the tricky things is how to refresh the screen when something happens. When an app is awaiting user input via
Mix.Shell.IO.prompt/1, is there any way to refresh/redraw the screen? For example, when something happens in the game, I would need to notify the user, and ideally I would want to do this BEFORE they input their next command and press enter.

I hope that makes sense. I’m scratching my head a bit when there is probably a simple solution. Thanks for any tips!

1 Like

There is no way in Mix or in general in Erlang, at least not built in. You will need to switch terminal to raw input mode and then you can control all text that is visible in the terminal emulator.

1 Like

Have a look at ex_termbox.


Thank you!