Interactive line input
For a complete example of usage of this module, look at the shell example (examples/shell.ml) distributed with Lambda-Term.
Exception raised when the user presses Ctrl^D
with an empty
input.
Returns the common prefix of a list of words.
(* | An edition action. | *) | |
#
| Interrupt_or_delete_next_char
| (* | Interrupt if at the beginning of an empty line, or delete the next character. | *) |
#
| Complete
| (* | Complete current input. | *) |
#
| Complete_bar_next
| (* | Go to the next possible completion in the completion bar. | *) |
#
| Complete_bar_prev
| (* | Go to the previous possible completion in the completion bar. | *) |
#
| Complete_bar_first
| (* | Goto the beginning of the completion bar. | *) |
#
| Complete_bar_last
| (* | Goto the end of the completion bar. | *) |
#
| Complete_bar
| (* | Complete current input using the completion bar. | *) |
#
| History_prev
| (* | Go to the previous entry of the history. | *) |
#
| History_next
| (* | Go to the next entry of the history. | *) |
#
| Accept
| (* | Accept the current input. | *) |
#
| Clear_screen
| (* | Clear the screen. | *) |
#
| Prev_search
| (* | Search backward in the history. | *) |
#
| Cancel_search
| (* | Cancel search mode. | *) |
#
| Break
| (* | Raise Sys.Break . | *) |
#
| Suspend
| (* | Suspend the program. | *) |
Type of actions.
doc_of_action action
returns a short description of the
action.
action_of_name str
converts the given action name into an
action. Action name are the same as variants name but lowercased
and with '_' replaced by '-'. It raises Not_found
if the name
does not correspond to an action. It also recognizes edition
actions.
Evaluates the contents of the engine.
Inserts the given character. Note that is it also possible to manipulate directly the edition context.
Returns the stylised input and the position of the cursor. The
argument is true
if this is for the last drawing or false
otherwise.
A message to display in the completion box. When None
the
completion should be displayed, and when Some msg
msg
should be displayed.
set_completion ?index start words
sets the current
completions. start
is the position of the beginning of the word
being completed and words
is the list of possible
completions with their suffixes. index
is the position in the completion
bar, default to 0
. The result is made available
through the completion_words signal.
Ask for computing completion for current input. This method should call set_completion.
Complete current input. This is the method called when the user presses Tab.
Whether to show the box or not. It default to true
.
The read-line engine. If no clipboard is provided, LTerm_edit.clipboard is used. If no macro recorder is provided, macro is used.
Read-line engine for reading a password. The stylise
method
default to replacing all characters by '*'
. You can also for
example completely disable displaying the password by doing:
method stylise = ([||], 0)
Also showing completion is disabled.
If the input correspond to a keyword, returns its associated
value. otherwise returns `Error input
.
List of keywords with their associated values.
Read a keyword.