package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_utils/Mopsa_utils/Core/LineEdit/index.html
Module Core.LineEdit
Simple line-editing for interactive sessions in the terminal. Assumes an UTF-8 console with standard ANSI escape codes.
Entering raw mode
*********************
val org_stdin_attr : Unix.terminal_io option
Exit raw mode after finishing line edition. Do not call print to the console when in raw mode.
FIFO character buffer
*************************
module FIFO : sig ... end
Character input
*******************
val rabuf : FIFO.t
We may need to scan the input to get the answer for a get_position call. Hence, we keep a FIFO of inputs read while scanning.
Non blocking read_char. Fetch from the read-ahead buffer first.
Block until a char is available and return it. Fetch from the read-ahead buffer first.
Cursor manipulation
***********************
val pf : ('a, out_channel, unit) format -> 'a
Clear the screen / line up to the cursor position from the begining.
Return the cursur line and column (starting at 1). Return (0,0) in case of an error.
UTF-8 buffers
*****************
module UBuf : sig ... end
Buffers backed by byte sequences that grow automatically. Support insertion and deletion at any position within the buffer. Include some support for UTF-8 encoding.
Line editing
****************
Line edition context, maintained between calls to read_line.
val create_ctx : unit -> ctx
val backslash_eol : Str.regexp
val read_line_tc : ctx -> string
Main line editing function, with support for cursor movement and history. You can print a prompt before calling this function. Return the string that was read. Throw Exit when Ctrl+C or Ctrl+D is typed.
val read_line : ctx -> string
Line edition, with fall-back to Stdlib.read_line if there is no terminal control.