Fancyline::Context
Inherits Reference / Object
Context of a currently running prompt. You usually don't have to
instantiate one yourself, but use Fancyline instead.
Context implements most of the user-facing operations like handling user
input and rendering the resulting output.
Constructors
Instance methods
Accepts the current input. This will make Fancyline#readline return
the line buffer in its current form to the caller.
Creates a new editor. Can be used by widgets to show an editor. The prompt has to start at the beginning of the output line.
Like #create_editor, but uses the supplied block as display function,
allowing the caller to transform an output string before writing it to
the screen.
Clears the sub-lines, moves the cursor onto the next line, and returns the current line buffer if it was accepted.
Draws the context onto the terminal. This method is called by
Fancyline#readline after every key-press.
Draws the sub information lines. The cursor is assumed to be a line above the target lines. The cursor will be moved back to the line, but placed at an unknown column.
Handles an input character, as if the user typed it.
This method should not be called from a widget. Call #handle_control
or #put_char directly instead.
Starts widget in this context. If there's already a widget active,
returns false. Returns true otherwise and calls Widget#start.
Usually called from a key handler (See #actions).
If a widget decides to not start, it's safe to call #stop_widget from
inside Widget#start to directly remove the widget again. This does not
affect the result of this method, which will stay to be true.
If a widget is currently running, stops and removes it. If no widget is running does nothing.