class Opal::Input::KeyMap

Overview

Declarative key binding and shortcut dispatch DSL.

Defined in:

opal/input/key_map.cr

Instance Method Summary

Instance Method Detail

def handle(event : Terminal::KeyEvent) : Bool #

Dispatches a KeyEvent through the registered key bindings. Returns true if a binding matched and was executed, false otherwise.


[View source]
def on(*keys : String, &block : -> Nil) : self #

Convenience overload when block takes 0 parameters


[View source]
def on_any(&block : Terminal::KeyEvent -> Nil) : self #

Registers a catch-all handler for any unhandled key


[View source]
def on_char(&block : Char -> Nil) : self #

Registers a handler for any printable character input


[View source]