jQuery Code Edit Box plugin

by nathan

HTML

<div id="edit"></div>

CSS

#edit {
    height: 8em;
    font-family: Courier New;
    border: thin black solid;
}

JavaScript

/*jslint sub: true, maxlen: 80, indent: 4 */
/*global jQuery */

// ==ClosureCompiler==
// @output_file_name jquery.codeEditBox.min.js
// @compilation_level ADVANCED_OPTIMIZATIONS
// @code_url http://goo.gl/eL6PR
// ==/ClosureCompiler==

(function ($) {
    "use strict";

    // Use square bracket notation for Closure Compiler
    $.fn['codeEditBox'] = function (options) {
        var self = this,
            pd,
            keyActions,
            keyNames;
        pd = function (e) {
            e.preventDefault();
        };
        
        keyNames = (function () {
            var keys = [],
                charKeys = '0123456789       abcdefghijklmnopqrstuvwxyz     0123456789',
                i = charKeys.length;
            while (i--) {
                if (charKeys[i] !== ' ') {
                    keys[i + 48] = charKeys[i];
                }
            }
            keys[8] = 'backspace';
            keys[9] = 'tab';
            keys[13] = 'return';
            keys[16] = 'shift';
            keys[17] = 'ctrl';
            keys[18] = 'alt';
            keys[19] = 'pause/break';
            keys[20] = 'caps lock';
            keys[27] = 'escape';
            keys[33] = 'pgup';
            keys[32] = 'space';
            keys[34] = 'pgdn';
            keys[35] = 'end';
            keys[36] = 'home';
            keys[37] = 'left';
            keys[38] = 'up';
            keys[39] = 'right';
            keys[40] = 'down';
            keys[44] = 'prntscn';
            keys[45] = 'ins';
            keys[46] = 'del';
            keys[91] = 'window';
            keys[92] = 'window';
            keys[93] = 'select';
            keys[106] = 'asterisk';
            keys[107] = 'plus';
            keys[109] = 'hyphen';
            keys[110] = 'full-stop';
            keys[111] = 'slash';
            keys[112] = 'f1';
            keys[113] = 'f2';
            keys[114] = 'f3';
            keys[115] = 'f4';
            keys[116] = 'f5';
            keys[117] =...