Browse Source

Fix for meta keys in a weird iTerm state.

v0.7.4-release
isaacs 14 years ago
committed by Ryan Dahl
parent
commit
49275524a5
  1. 7
      lib/tty_posix.js

7
lib/tty_posix.js

@ -93,7 +93,7 @@ ReadStream.prototype.isTTY = true;
// Regexes used for ansi escape code splitting // Regexes used for ansi escape code splitting
var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/, var metaKeyCodeRe = /^(?:\x1b)([a-zA-Z0-9])$/,
functionKeyCodeRe = 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) { ReadStream.prototype._emitKey = function(s) {
var char, var char,
@ -106,8 +106,13 @@ ReadStream.prototype._emitKey = function(s) {
parts; parts;
if (Buffer.isBuffer(s)) { if (Buffer.isBuffer(s)) {
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'); s = s.toString(this.encoding || 'utf-8');
} }
}
if (s === '\r') { if (s === '\r') {
// enter // enter

Loading…
Cancel
Save