Module Lwt_read_line.Engine
module Engine : sig..end
Engine
Note: this part know nothing about rendering or completion.
type selection_state = { sel_text: Text.t;(* The whole input text on which the selection is working *) sel_mark: Text.pointer;(* Pointer to the mark *) sel_cursor: Text.pointer;(* Pointer to the cursor *)}
State when the user is doing selection:
type search_state = { search_word: Text.t;(* The word we are looking for *) search_history: Lwt_read_line.history;(* Position in history. The first element is a sentence containing the searched word *) search_init_history: Lwt_read_line.history;(* The initial history, before searching for a word *)}
State when searching in the history
type mode = | Edition of Lwt_read_line.edition_state(* The user is typing some text *) | Selection of selection_state(* The user is selecting some text *) | Search of search_state(* The user is searching the given word in the history *)
The engine mode:
type state = { mode: mode; history: Lwt_read_line.history * Lwt_read_line.history;(* Cursor to the history position. *)}
An engine state:
val init : Lwt_read_line.history -> state
init history return a initial state using the given history
val reset : state -> state
reset state reset the given state, if the user was doing a selection, it is canceled
val update :
engine_state:state ->
?clipboard:Lwt_read_line.clipboard ->
command:Lwt_read_line.Command.t -> unit -> state
update ~state ?clipboard ~command () update an engine state by processing the given command. It returns the new state, and may have the side effect of changing the clipboard contents.
clipboard defaults to the global clipboard.
val edition_state : state -> Lwt_read_line.edition_state
Returns the edition state of a state, whatever its mode is.
val all_input : state -> Text.t
Returns the current complete user input.