module Linenoise
Defined in:
linenoise.crlinenoise/completion.cr
Constant Summary
-
VERSION =
"0.4.0"
Class Method Summary
-
.add_completion(completion_state : Pointer(LibLinenoise::Completions), completion : String)
This method should only be called inside the completion callback to register valid completions.
-
.add_history(line : String) : Bool
Register the most recent line to the history.
-
.clear_screen
Clears the entire screen and sets the cursor to the top left corner.
-
.load_history(filename : String) : Bool
Load the history from a file.
-
.max_history(length : Int) : Bool
Change the maximum number of lines in the history.
-
.print_key_codes
Only used for debugging.
-
.prompt(prompt : String) : String | Nil
Prompts the user for a new line of input.
-
.save_history(filename : String) : Bool
Write the current history to a file.
-
.set_completion_callback(callback : CompletionCallback)
Note: The completion callback cannot be a closure since it will end up being passed to the C library internally and that is a compiler error.
-
.set_encoding(encoding : Encoding)
Set the string encoding for the linenoise session.
-
.set_hints_callback(callback : HintsCallback)
Note: The hints callback cannot be a closure since it will end up being passed to the C library internally and that is a compiler error.
-
.set_mask_mode(mask_mode : Bool)
Set text input masking.
-
.set_multiline(multiline : Bool)
Single line mode: Scrolls to the right if input text becomes wider than the current window.
Class Method Detail
This method should only be called inside the completion callback to register valid completions.
Register the most recent line to the history. It will be the first option when the user presses the up arrow key.
Note: The completion callback cannot be a closure since it will end up being passed to the C library internally and that is a compiler error.
Set the string encoding for the linenoise session. It defaults to UTF8.
Note: The hints callback cannot be a closure since it will end up being passed to the C library internally and that is a compiler error.
Set text input masking. This prevents the user's keyboard input from being echoed automatically to the screen. Instead, the characters all get converted to asterisks (*). This is useful when users are entering passwords for example.
By default mask mode is disabled.
Single line mode: Scrolls to the right if input text becomes wider than the current window. Mutiline mode: Wraps the input text if it becomes wider than the current window.
Defaults to single line mode.