class
CryPrompt::AutoComplete
- CryPrompt::AutoComplete
- Reference
- Object
Defined in:
autocomplete.crConstant Summary
-
ANSI_ESCAPE =
/\e\[[0-?]*[ -\/]*[@-~]/ -
TIOCGWINSZ =
21523_u32
Constructors
Instance Method Summary
- #box_color : Colorize::Color
- #box_color=(box_color : Colorize::Color)
- #box_text_background_color : Colorize::Color
- #box_text_background_color=(box_text_background_color : Colorize::Color)
- #box_text_foreground_color : Colorize::Color
- #box_text_foreground_color=(box_text_foreground_color : Colorize::Color)
- #case_sensitive : Bool
- #case_sensitive=(case_sensitive : Bool)
- #chose_from_render
-
#clear_line_below(current_line_index)
dont use this just use print Keys::ClearScreenBelow
- #clear_x_below(number_of_lines, current_line_index)
-
#completion : JSON::Any | YAML::Any | Nil
load a yaml or json hash to parse from you still need to call update_suggestions to parse it
-
#completion=(completion : JSON::Any | YAML::Any | Nil)
load a yaml or json hash to parse from you still need to call update_suggestions to parse it
-
#completion_suffix(candidate : String, prefix : String) : String
Returns only the untyped suffix of a matching candidate.
-
#current_word(line : String) : String
The token currently being completed.
-
#display_width(value : String) : Int32
Approximate wcwidth for the ranges commonly encountered in prompts.
- #get_terminal_size
-
#print_suggestions(opts : Array(String), word : String = "", current_line_index : Int32 = 0)
bash style single line tab suggest
-
#render(opts : Array(CryPromptTrie), current_line_index : Int32, word : String, tabc : Int32 = -1, prompt_size : Int32 = 2, line_size : Int32 = 0, io : IO = STDOUT, terminal_width : Int32 | Nil = nil, more : Bool | Nil = nil) : String
Renders at most five suggestions below the current word.
-
#render_box(opts : Array(String), selected_index : Int32 = -1, max_suggested : Int32 = 5, min_width_size : Int32 = 4)
NOT WORKING (probably due to scos/rc) draws the box with the suggestions in it.
-
#sanitize(value : String) : String
Removes control sequences that could break the menu's rows.
-
#suggestion_nodes(line : String, trie = @sugtrie) : Array(CryPromptTrie)
returns an array of words from the sugtrie that fall in line with the given line
-
#suggestions(line : String, trie = @sugtrie) : Array(String)
returns an array of words from the sugtrie that fall in line with the given line
- #sugtrie : CryPromptTrie
- #sugtrie=(sugtrie : CryPromptTrie)
- #truncate_to_width(value : String, maximum : Int32) : String
-
#update_suggestions(completion : JSON::Any | YAML::Any | Nil = @completion, trie : CryPromptTrie = @sugtrie)
recursive function to generate the suggestion trie from a json or yaml structure
Constructor Detail
Instance Method Detail
load a yaml or json hash to parse from you still need to call update_suggestions to parse it
load a yaml or json hash to parse from you still need to call update_suggestions to parse it
Returns only the untyped suffix of a matching candidate.
The token currently being completed. An empty string means the cursor follows whitespace and the next command word is being selected.
Approximate wcwidth for the ranges commonly encountered in prompts.
bash style single line tab suggest
Renders at most five suggestions below the current word. Widths are terminal-cell widths, and oversized values are truncated instead of suppressing the entire menu.
NOT WORKING (probably due to scos/rc) draws the box with the suggestions in it. selected_index is the index in opts that will be selected to be highlighted max_size is the width of the box max_suggested is how many items will be suggested at the maximum
returns an array of words from the sugtrie that fall in line with the given line
returns an array of words from the sugtrie that fall in line with the given line
recursive function to generate the suggestion trie from a json or yaml structure