module Terminal:sig
..end
type
state
val init : state
type
box =
| |
Box_none |
(* | No box at all | *) |
| |
Box_empty |
(* | An empty box | *) |
| |
Box_words of |
(* | BM_words(words, position) is a box with the given list
of words. position is the position of the selected word
in the list.. | *) |
| |
Box_message of |
(* | A box containing only the given message | *) |
val draw : columns:int ->
?map_text:(Text.t -> Text.t) ->
?box:box ->
render_state:state ->
engine_state:Lwt_read_line.Engine.state ->
prompt:Lwt_read_line.prompt ->
unit -> Lwt_term.styled_text * state
draw ~column ?map_text ?bar ~render_state ~engine_state
prompt ()
returns (text, state)
where state
is the new
rendering state, and text
is a text containing escape
sequences. When printed, it will update the displayed state.map_text
: is a function used to map user input before
printing it, for example to hide passwords.box
: defaults to Box_none
.val last_draw : columns:int ->
?map_text:(Text.t -> Text.t) ->
render_state:state ->
engine_state:Lwt_read_line.Engine.state ->
prompt:Lwt_read_line.prompt -> unit -> Lwt_term.styled_text
val erase : columns:int ->
render_state:state -> unit -> Lwt_term.styled_text
erase ~columns ~render_state ()
returns a text which will
erase everything (the prompt, user input, completion, ...).
After an erase, the rendering state is init
.