chjj/tty.js — pull request #14 by tjfontaine (2012-03-13 16:10:31+00:00)
Title: refactor Terminal to accept custom KeyMap

I needed to accommodate users who expected remapped keys for a legacy application.

* Adds optional keyMap argument to `Terminal`
* Adds `keyMap` property to `Terminal` if no custom keyMap is specified initialized with `defaultMap`
* `KeyMap` accepts an object whose indexers are `keyCode`s, the value may be either a `string` or `Object`
- A string is translated into an object like `{ default: }`

```javascript
{
default: '', // only one required, used if no other masks are matched
ctrl: '', // (optional) string that is returned when ctrl+keycode is pressed
shift: '', // (optional) string that is returned when shift+keycode is pressed
ctrlShift: '', // (optional) string that is returned when ctrl+shift+keycode is pressed
}
```

If any field is `true` then `Terminal` will assume it's a case that needs to be handled without a round trip, for instance, scrolling the display.