package mopsa
Install
Dune Dependency
Authors
Maintainers
Sources
md5=fdee20e988343751de440b4f6b67c0f4
sha512=f5cbf1328785d3f5ce40155dada2d95e5de5cce4f084ea30cfb04d1ab10cc9403a26cfb3fa55d0f9da72244482130fdb89c286a9aed0d640bba46b7c00e09500
doc/utils_core/Utils_core/LineEdit/index.html
Module Utils_core.LineEdit
Source
Simple line-editing for interactive sessions in the terminal. Assumes an UTF-8 console with standard ANSI escape codes.
Entering raw mode
*********************
Whether terminal control is available
Enter raw mode before starting line edition.
Exit raw mode after finishing line edition. Do not call print to the console when in raw mode.
FIFO character buffer
*************************
Character input
*******************
Non blocking read_char.
Block until a char is available and return it.
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.
Put (back) in FIFO.
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.
Put all chars possible in the read-ahead buffer.
Cursor manipulation
***********************
Moves the cursor up, down, left, or right n positions.
Go to the begining of the n-th next / previous line.
Move to line l, column c (starting at 1).
Clear the whole screen / line.
Clear the screen / line from the cursor position until the end.
Clear the screen / line up to the cursor position from the begining.
Scroll some number of lines up / down.
Save / restore the cursor position.
Return the cursur line and column (starting at 1). Return (0,0) in case of an error.
Return the height and width of the window.
UTF-8 buffers
*****************
Byte-size of the utf-8 char starting with code c.
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.
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.