Fancyline::Editor
Inherits Fancyline::Drawable / Reference / Object
Editor for a line of input featuring a prompt. Used by Context for the
main prompt, but can also used by Widgets to show an editor e.g. in a
sub_info middleware.
Use Context#create_editor instead of instantiating this yourself.
Constants
Default display function
Minimum space (in characters) between the rprompt and the prompt line. The right-prompt will be hidden if not satisfiable.
Constructors
Instance methods
Applies completion to the string buffer, and adjusts the cursor to be
just after the Completion#word.
Position of the cursor, starting right after the prompt. Legal values are
[0..line.size] - Including line.size, just after the line buffer ends.
Position of the cursor, starting right after the prompt. Legal values are
[0..line.size] - Including line.size, just after the line buffer ends.
Function used to transform a line to a displayable string.
Draws the context onto the terminal. This method is called by
Fancyline#readline after every key-press.
Current line buffer. Modifying it from everywhere outside the Context
itself is fine and is done everywhere it's useful. Make sure to also
update the #cursor.
Current line buffer. Modifying it from everywhere outside the Context
itself is fine and is done everywhere it's useful. Make sure to also
update the #cursor.
Prompt, a string shown just before the user input. Used to display relevant, but usually short, information.
Prompt, a string shown just before the user input. Used to display relevant, but usually short, information.
Writes char at the cursor, moving the cursor onward, as if the user had input it.
Removes count characters at the cursor position. If count is negative, moves the cursor count times to the left, removing count characters (Backspace functionality). If count is positive, removes the following count characters, but doesn't move the cursor (Delete functionality). The count is automatically clamped to the line size, it can't get out of bounds.
Prompt displayed on the right side, which will disappear when the prompt input gets near it. Can be used to display information like current time, or other short data. Popularized by ZSH.
See Fancyline#readline to easily set this property.
Prompt displayed on the right side, which will disappear when the prompt input gets near it. Can be used to display information like current time, or other short data. Popularized by ZSH.
See Fancyline#readline to easily set this property.
Looks for a word under, or just before, offset.
If found, returns a tuple of the word itself, and its starting position in
the current line buffer. If not found, returns nil.
A non-alphanumeric beginning is never considered to be a word.