I wonder how I can use LTerm.Widget
and LTerm.read_line
together.
I would like to have two boxes: the top scrollable box to show some running results and the bottom box to read my commands.
I checked the current lambda-term/examples but haven’t found a case.
In the examples, the entry of the main loop is either
LTerm_widget.run term vbox waiter
-
loop term (LTerm_history.create []) state)
(which containslet rl = new read_line ~term ~history:(LTerm_history.contents history) ~state in rl#run ...
Either LTerm_widget.run
and LTerm.read_line.run
seem to control the term
exclusively. I also don’t find a way to add widget/read_line to the term
out of the run
functions.
For curiosity, Lwt.pick [ LTerm_widget.run term vbox waiter; rl_loop term history state () ]
raises "LTerm.read_event: cannot read events from two threads at the same time"
. I can guess both are top-level components to hold the event loop.
It’s also OK if I can confirm they cannot be used together. LTerm.read_line
would be enough for me.