I'm trying to implement an application similar to a chat client where messages can arrive while the user is typing his own message.
I'll explain how I want my program to behave with an example: Before an incoming message:
>user partial input
After an incoming message:
>the new message
>user partial input(cursor is here)
Instead what naturally happens after an incoming message is this:
>user partial input the new message
>(cursor is here)
After that the user can still use backspace to delete what he wrote before but it doesn't show on the screen and there's a UI mess overall.
Is there any way to achieve the desired behavior without using ncurses?
Thank you.
Edit: Sorry, I forgot to write what my environment is, it's Cygwin. Thanks for all of the answers.