Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan VerWeire <dverweire@gmail.com>2012-01-28 03:49:07 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2012-01-28 20:01:04 +0400
commite4afb2f724f0a42c946ded3805f6827f8ed3868c (patch)
tree2f465519a0c8f90b3f7690d05597df1fe2e1f513 /lib
parent14b7c4327f4547bed14bf2059321375b75d9c45e (diff)
tty: emit 'unknown' key event if key sequence not found
Add key.code and key.sequence -mad props go out to @TooTallNate
Diffstat (limited to 'lib')
-rw-r--r--lib/tty.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tty.js b/lib/tty.js
index dccda5a4812..c1bbba1b06a 100644
--- a/lib/tty.js
+++ b/lib/tty.js
@@ -154,6 +154,8 @@ ReadStream.prototype._emitKey = function(s) {
}
}
+ key.sequence = s;
+
if (s === '\r' || s === '\n') {
// enter
key.name = 'enter';
@@ -210,6 +212,7 @@ ReadStream.prototype._emitKey = function(s) {
key.ctrl = !!(modifier & 4);
key.meta = !!(modifier & 10);
key.shift = !!(modifier & 1);
+ key.code = code;
// Parse the key itself
switch (code) {
@@ -305,6 +308,7 @@ ReadStream.prototype._emitKey = function(s) {
/* misc. */
case '[Z': key.name = 'tab'; key.shift = true; break;
+ default: key.name = 'undefined'; break;
}
} else if (s.length > 1 && s[0] !== '\x1b') {