Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix for meta keys in a weird iTerm state.

  • Loading branch information...
commit 49275524a5d33acc16eb440173f94f92d28b6352 1 parent d40af91
@isaacs isaacs authored ry committed
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/tty_posix.js
View
9 lib/tty_posix.js
@@ -93,7 +93,7 @@ ReadStream.prototype.isTTY = true;
// Regexes used for ansi escape code splitting
var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/,
functionKeyCodeRe =
- /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;(\d+))?([a-zA-Z]))/;
+ /^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/;
ReadStream.prototype._emitKey = function(s) {
var char,
@@ -106,7 +106,12 @@ ReadStream.prototype._emitKey = function(s) {
parts;
if (Buffer.isBuffer(s)) {
- s = s.toString(this.encoding || 'utf-8');
+ if (s[0] > 127 && s[1] === undefined) {
+ s[0] -= 128;
+ s = '\x1b'+s.toString(this.encoding || 'utf-8');
+ } else {
+ s = s.toString(this.encoding || 'utf-8');
+ }
}
if (s === '\r') {
Please sign in to comment.
Something went wrong with that request. Please try again.