I have a small interactive commandline application where i use the prompt function from prompt_toolkit to read user commands. Some commands will open threaded listeners to ports and will print to screen whenever something comes in on the port it is listening to. The problem I have is that this print will mess with the current line the user is inputting, in the sence that is will overwrite the text (the buffer is still there so you can execute command but you wont see what was typed). The behaviour I would like to have is to have the listeners print their text one line above the line where input is taken.
Or, in other words, store the line currently written, clear the line and carrage return, print the received message, newline then print the stored line. Is this possible with prompt_toolkit?
thanks