class Fancyline::Widget::Completion

Overview

Implements the user-interaction for TAB-autocompletion. Completion suggestions are created using the Fancyline#autocomplete middleware.

Defined in:

fancyline/widget/completion.cr

Constant Summary

MAX_COMPLETIONS = 20

Hard limit of completions. More are discarded.

Instance Method Summary

Instance methods inherited from class Fancyline::Widget

handle(ctx : Context, char : Char) : Bool handle, start(ctx : Context) start, stop(ctx : Context) stop

Instance Method Detail

def apply_suggestion(ctx, completion) #

[View source]
def completion_info_string(ctx) #

[View source]
def fetch_suggestions(ctx, range, word) #

[View source]
def handle(ctx : Context, char : Char) : Bool #
Description copied from class Fancyline::Widget

Called on user-input. Return true if you handeled the input, return false to handle it as normal input by the Context.

The default implementation calls Context#stop_widget to remove itself, and returns false.


[View source]
def handle_control(ctx, char) #

[View source]
def handle_quick_select(ctx, char) #

[View source]
def move_entry(ctx, offset) #

[View source]
def start(ctx : Context) #
Description copied from class Fancyline::Widget

Called when the widget is activated.


[View source]
def stop(ctx : Context) #
Description copied from class Fancyline::Widget

Called when the widget is removed.


[View source]