Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
Fix issue with alt key (#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-gross authored Nov 2, 2016
1 parent b8d09dd commit 2bc11d1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/shell/Job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,19 @@ export class Job extends EmitterWithUniqueID implements TerminalLikeDevice {
if (typeof input === "string") {
text = input;
} else {
text = input.ctrlKey ? String.fromCharCode(input.keyCode - 64) : normalizeKey(input.key, this.screenBuffer.cursorKeysMode);
if (input.ctrlKey) {
text = String.fromCharCode(input.keyCode - 64);
} else if (input.altKey) {
let char = String.fromCharCode(input.keyCode);
if (input.shiftKey) {
char = char.toUpperCase();
} else {
char = char.toLowerCase();
}
text = `\x1b${char}`;
} else {
text = normalizeKey(input.key, this.screenBuffer.cursorKeysMode);
}
}

this.command.write(text);
Expand Down

0 comments on commit 2bc11d1

Please sign in to comment.