gchp/iota — pull request #31 by Crespyl (2014-12-13 16:34:03+00:00)
Title: Keymap

This is a rough-around-the-edges take on implementing a general purpose key-sequence => command binding framework. See also #30.

The `KeyMap` holds a `Trie` that maps `Key` nodes to editor `Command`s, with a bit of state to keep track of incoming key presses.

The editor can then feed keystrokes to the KeyMap, and receive either a matching `Command`, a `Continue` signaling a partial result that needs more keys to disambiguate, or a `None` indicating that no match was found and the key should be handled normally.

I don't really know what I'm doing here, so there's certainly a lot of room for cleanup and improvements.