New API for pushing output messages to be printed by the editor
Discussed with @jntrnr on Discord, writing up an issue so it's not lost.
reedline has Reedline::read_line() and Reedline::print_line() APIs. I wanted to use these APIs to print "auxiliary" messages coming from any source. Unfortunately there are two problems with that approach at the moment:
a) both APIs both require mutable reference to the instance,
b) read_line() is blocking and there's no API (a public API) that would allow to read for at most X ms before yielding back control to the caller
In my use case I want to use the editor on one thread, but also be able to print messages coming from multiple other threads. A naive approach is to just print these messages directly using something like println!, however this can easily cause the input prompt line to get interleaved with output from other threads.
So ideally reedline could have an API that would allow to push messages that could be picked up by the editor instance and printed at first convenience (eg. on read timeout in read_line_helper).
Ref https://github.com/denoland/deno/issues/13125
@bartlomieju we now have a MVP support for printing whole line messages thanks to #467 by @GrxE