fix enter key workaround. minor. typo.

This commit is contained in:
Christopher Jeffrey 2013-08-18 14:42:39 -05:00
parent 18d97ce0d7
commit 0eaff0bb07
2 changed files with 13 additions and 6 deletions

View File

@ -259,9 +259,7 @@ Program.prototype.listen = function() {
}
if (key.name === 'return' && key.sequence === '\r') {
key.name = 'enter';
self.input.emit('keypress', ch, key);
key.name = 'return';
self.input.emit('keypress', ch, merge({}, key, { name: 'enter' }));
}
var name = (key.ctrl ? 'C-' : '')
@ -3568,6 +3566,15 @@ function unshiftEvent(obj, event, listener) {
});
};
function merge(out) {
slice.call(arguments, 1).forEach(function(obj) {
Object.keys(obj).forEach(function(key) {
out[key] = obj[key];
});
});
return out;
}
/**
* Expose
*/

View File

@ -893,7 +893,7 @@ Screen.prototype.draw = function(start, end) {
}
if (clr && neq) {
lx = ly = -1;
lx = -1, ly = -1;
if (data !== attr) {
out += this.codeAttr(data);
attr = data;
@ -917,7 +917,7 @@ Screen.prototype.draw = function(start, end) {
// supports it. Maybe only try to use ECH here.
// //if (this.tput && this.tput.strings.erase_chars)
// if (!clr && neq && (xx - x) > 10) {
// lx = ly = -1;
// lx = -1, ly = -1;
// if (data !== attr) {
// out += this.codeAttr(data);
// attr = data;
@ -1860,7 +1860,7 @@ function Element(options) {
});
this.on('detach', function() {
delete self._lpos;
delete self.lpos;
});
if (options.hoverBg != null) {