class Fancyline::Widget::History

Overview

Implements a simple history access feature. Activated by hitting the "Up" key, then accepts "Up" and "Down" to navigate the history.

The source code of this widget has exhaustive commentary, which hopefully makes this useful to you, the reader, for studying! It's put to use in KeyAction::DEFAULTs handler for Key::Control::Up.

Defined in:

fancyline/widget/history.cr

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 handle(ctx : Context, char : Char) : Bool #

Handles user input. Called by Fancyline::Context#handle.


[View source]
def history : Fancyline::History | Nil #

The history we're operating on. Initialized in #start.


[View source]
def history? : Fancyline::History | Nil | Nil #

The history we're operating on. Initialized in #start.


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

Shows a history entry, moving in it by offset entries.


[View source]
def start(ctx : Context) #

Starts the widget.


[View source]