# Class virtual LTerm_read_line.engine

    class virtual ['a] engine : ?history:history -> ?clipboard:Zed_edit.clipboard -> ?macro:action Zed_macro.t -> unit -> object .. end

The read-line engine. If no clipboard is provided, `LTerm_edit.clipboard` is used. If no macro recorder is provided, `LTerm_read_line.engine.macro` is used.

###### Result

    method virtual eval : 'a

Evaluates the contents of the engine.

###### Actions

    method insert : CamomileLibrary.UChar.t -> unit

Inserts the given character. Note that is it also possible to manipulate directly the edition context.

    method send_action : action -> unit

Evolves according to the given action.

###### State

    method edit : unit Zed_edit.t

The edition engine used by this read-line engine.

    method context : unit Zed_edit.context

The context for the edition engine.

    method clipboard : Zed_edit.clipboard

The clipboard used by the edition engine.

    method macro : action Zed_macro.t

The macro recorder.

    method input_prev : Zed_rope.t

The input before the cursor.

    method input_next : Zed_rope.t

The input after the cursor.

    method mode : mode React.signal

The current mode.

    method stylise : bool -> LTerm_text.t * int

Returns the stylised input and the position of the cursor. The argument is `true` if this is for the last drawing or `false` otherwise.

    method history : (Zed_utf8.t list * Zed_utf8.t list) React.signal

The history zipper.

    method message : LTerm_text.t option React.signal

A message to display in the completion box. When `None` the completion should be displayed, and when `Some msg` `msg` should be displayed.

###### Completion

    method completion_words : (Zed_utf8.t * Zed_utf8.t) list React.signal

Current possible completions. Each completion is of the form `(word, suffix)` where `word` is the completion itself and `suffix` is a suffix to add if the completion is choosen.

    method completion_index : int React.signal

The position in the completion bar.

    method set_completion : int -> (Zed_utf8.t * Zed_utf8.t) list -> unit

`set_completion index words` sets the current completions. `index` is the index of the beginning of the word being completed and `words` is the list of possible completions with their suffixes. The result is made available through the `compltion_words` signal.

    method completion : unit

Ask for computing completion for current input. This method should call `LTerm_read_line.engine.set_completion`.

    method complete : unit

Complete current input. This is the method called when the user presses Tab.

    method show_box : bool

Whether to show the box or not. It default to `true`.