tty: emit 'unknown' key event if key sequence not found
Add key.code and key.sequence -mad props go out to @TooTallNate
This commit is contained in:
parent
14b7c4327f
commit
e4afb2f724
@ -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') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user