Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc OS X and Emacs (including PR #7) #36

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 99 additions & 7 deletions src/term.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ Terminal.prototype.open = function(parent) {
this.focus();

// Start blinking the cursor.
this.startBlink();
//this.startBlink();

// Bind to DOM events related
// to focus and paste behavior.
Expand Down Expand Up @@ -2612,14 +2612,106 @@ Terminal.prototype.keyDown = function(ev) {
// ^] - group sep
key = String.fromCharCode(29);
}
} else if ((!this.isMac && ev.altKey) || (this.isMac && ev.metaKey)) {
if (ev.keyCode >= 65 && ev.keyCode <= 90) {
key = '\x1b' + String.fromCharCode(ev.keyCode + 32);
} else if (ev.keyCode === 192) {
} else if (ev.altKey) {
switch (ev.keyCode) {
case 59:
if (ev.shiftKey) {
key = '\x1b:';
break;
}
key = '\x1b;';
break;
case 61:
if (ev.shiftKey) {
key = '\x1b+';
break;
}
key = '\x1b=';
break;
case 188:
if (ev.shiftKey) {
key = '\x1b<';
break;
}
key = '\x1b,';
break;
case 109:
if (ev.shiftKey) {
key = '\x1b_';
break;
}
key = '\x1b-';
break;
case 190:
if (ev.shiftKey) {
key = '\x1b>';
break;
}
key = '\x1b.';
break;
case 191:
if (ev.shiftKey) {
key = '\x1b?';
break;
}
key = '\x1b/';
break;
case 192:
if (ev.shiftKey) {
key = '\x1b~';
break;
}
key = '\x1b`';
} else if (ev.keyCode >= 48 && ev.keyCode <= 57) {
key = '\x1b' + (ev.keyCode - 48);
break;
case 219:
if (ev.shiftKey) {
key = '\x1b{';
break;
}
key = '\x1b[';
break;
case 220:
if (ev.shiftKey) {
key = '\x1b|';
break;
}
key = '\x1b\\';
break;
case 221:
if (ev.shiftKey) {
key = '\x1b}';
break;
}
key = '\x1b]';
break;
case 222:
if (ev.shiftKey) {
key = '\x1b"';
break;
}
key = '\x1b]\'';
break;
default:
if (ev.keyCode >= 65 && ev.keyCode <= 90) {
if (ev.shiftKey) {
key = '\x1b' + String.fromCharCode(ev.keyCode);
} else {
key = '\x1b' + String.fromCharCode(ev.keyCode + 32);
}
} else if (ev.keyCode >= 48 && ev.keyCode <= 57) {
if (ev.shiftKey) {
if (ev.keyCode == 50) {
key = '\x1b' + String.fromCharCode(ev.keyCode - 48 + 32 + 32);
} else {
key = '\x1b' + String.fromCharCode(ev.keyCode - 48 + 32);
}
} else {
key = '\x1b' + (ev.keyCode - 48);
}
}
}
} else if (this.isMac && ev.metaKey) {
return true;
}
break;
}
Expand Down